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

Fix unstable test in test_utils.py #654

Open
olliesilvester opened this issue Nov 15, 2024 · 2 comments
Open

Fix unstable test in test_utils.py #654

olliesilvester opened this issue Nov 15, 2024 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@olliesilvester
Copy link
Contributor

Sometimes test_given_detector_move_fails_then_eiger_disarmed_and_correct_exception_returned fails, probably due to something in pytest not being cleaned up properly.

Here's the (not massively helpful) traceback for when it fails

__________ test_given_detector_move_fails_then_eiger_disarmed_and_correct_exception_returned __________
Traceback (most recent call last):
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 341, in from_call
    result: TResult | None = func()
                             ^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 242, in <lambda>
    lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
    raise exception.with_traceback(exception.__traceback__)
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/threadexception.py", line 92, in pytest_runtest_call
    yield from thread_exception_runtest_hook()
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/threadexception.py", line 68, in thread_exception_runtest_hook
    yield
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py", line 95, in pytest_runtest_call
    yield from unraisable_exception_runtest_hook()
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py", line 70, in unraisable_exception_runtest_hook
    yield
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/logging.py", line 846, in pytest_runtest_call
    yield from self._runtest_for(item, "call")
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/logging.py", line 829, in _runtest_for
    yield
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/capture.py", line 880, in pytest_runtest_call
    return (yield)
            ^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 122, in _multicall
    teardown.throw(exception)  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/skipping.py", line 257, in pytest_runtest_call
    return (yield)
            ^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 174, in pytest_runtest_call
    item.runtest()
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/python.py", line 1627, in runtest
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 513, in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 182, in _multicall
    return outcome.get_result()
           ^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_result.py", line 100, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 103, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/_pytest/python.py", line 159, in pytest_pyfunc_call
    result = testfunction(**testargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/tests/unit_tests/hyperion/device_setup_plans/test_utils.py", line 84, in test_given_detector_move_fails_then_eiger_disarmed_and_correct_exception_returned
    RE(
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/bluesky/run_engine.py", line 973, in __call__
    plan_return = self._resume_task(init_func=_build_task)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/bluesky/run_engine.py", line 1109, in _resume_task
    raise exc
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/bluesky/run_engine.py", line 1751, in _run
    raise err
  File "/scratch/qqh35939/mx-bluesky/.venv/lib/python3.11/site-packages/bluesky/run_engine.py", line 1638, in _run
    msg.command,
    ^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'command'

Acceptance Criteria

  • Test improved
@olliesilvester olliesilvester added bug Something isn't working good first issue Good for newcomers labels Nov 15, 2024
@malikrohail
Copy link

can i fix this

@olliesilvester
Copy link
Contributor Author

Yes please!

@olliesilvester olliesilvester moved this to Candidates for Next Sprint in Hyperion Nov 28, 2024
@olliesilvester olliesilvester moved this from Candidates for Next Sprint to Backlog in Hyperion Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Status: Backlog
Development

No branches or pull requests

2 participants