Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky test in test_utils #1022

Open
stan-dot opened this issue Jan 27, 2025 · 8 comments
Open

Flaky test in test_utils #1022

stan-dot opened this issue Jan 27, 2025 · 8 comments
Labels

Comments

@stan-dot
Copy link
Contributor

FAILED tests/devices/unit_tests/test_utils.py::test_wrap_function_callback_errors_on_wrong_return_type - AssertionError: assert 'does not return a Status' in 'WARNING ophyd:status.py:254 Status(obj=None, done=False, success=False) has timed out\n'

  • where 'WARNING ophyd:status.py:254 Status(obj=None, done=False, success=False) has timed out\n' = <_pytest.logging.LogCaptureFixture object at 0x7f687030f920>.text

https://github.com/DiamondLightSource/dodal/actions/runs/12991801896/job/36230206846?pr=722

@stan-dot stan-dot added the tests label Jan 27, 2025
@stan-dot
Copy link
Contributor Author

the test is successful locally though

@stan-dot
Copy link
Contributor Author

'ERROR Dodal:epics_util.py:73 wrap_func attempted to wrap <MagicMock id=\'139693409217488\'> when it does not return a Status\nERROR ophyd:status.py:289 An error was raised on a background thread while running the callback functools.partial(<function run_functions_without_blocking.<locals>.wrap_func at 0x7f0ccfbf2520>, current_func=<MagicMock id=\'139693409217488\'>, next_func=<function run_functions_without_blocking.<locals>.closing_func at 0x7f0ccfbf27a0>)(Status(obj=Dodal test utils - get good status, done=True, success=True)).\nTraceback (most recent call last):\n File "/venv/lib/python3.11/site-packages/ophyd/status.py", line 287, in _run_callbacks\n cb(self)\n File "/workspaces/dodal/src/dodal/devices/util/epics_util.py", line 76, in wrap_func\n raise ValueError(f"{current_func} does not return a Status")\nValueError: <MagicMock id=\'139693409217488\'> does not return a Status\nWARNING ophyd:status.py:254 Status(obj=None, done=False, success=False) has timed out\n'

the log is like above. It arguably contains the requested string

@stan-dot
Copy link
Contributor Author

stan-dot commented Jan 27, 2025

locally was running:

ophyd-async==0.9.0a1```


while the CI has:

```ophyd==1.10.0,ophyd-async==0.9.0a1```

@stan-dot
Copy link
Contributor Author

running again, trying debugging logging

@stan-dot
Copy link
Contributor Author

now it worked. looking for reasons of non-determinism

  congratulations :)```

@stan-dot
Copy link
Contributor Author

@DominicOram I took a quick look into this - does the draft branch make any sense?

@DominicOram
Copy link
Contributor

@DominicOram I took a quick look into this - does the draft branch make any sense?

No, I don't think that will work, you need to patch the full path to where it's imported (https://stackoverflow.com/questions/11351382/mock-patching-from-import-statement-in-python).

This test is pretty horrible and niche, if it's flakiness is holding you up feel free to comment it out and link to this issue

@stan-dot
Copy link
Contributor Author

not really it's not holding me up[

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants