1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-01-01 11:31:19 +01:00

fix(becconnector): ophyd thread killer on exit + in conftest

This commit is contained in:
2025-10-28 20:39:19 +01:00
committed by Jan Wyzula
parent 8776784507
commit 7f488c09ef
2 changed files with 15 additions and 0 deletions

View File

@@ -129,6 +129,17 @@ class BECConnector:
def terminate(client=self.client, dispatcher=self.bec_dispatcher):
logger.info("Disconnecting", repr(dispatcher))
dispatcher.disconnect_all()
try: # shutdown ophyd threads if any
from ophyd._pyepics_shim import _dispatcher
_dispatcher.stop()
logger.info("Ophyd dispatcher shut down successfully.")
except Exception as e:
logger.warning(
f"Error shutting down ophyd dispatcher: {e}\n{traceback.format_exc()}"
)
logger.info("Shutting down BEC Client", repr(client))
client.shutdown()

View File

@@ -41,6 +41,10 @@ def qapplication(qtbot, request, testable_qtimer_class): # pylint: disable=unus
# if the test failed, we don't want to check for open widgets as
# it simply pollutes the output
# stop pyepics dispatcher for leaking tests
from ophyd._pyepics_shim import _dispatcher
_dispatcher.stop()
if request.node.stash._storage.get("failed"):
print("Test failed, skipping cleanup checks")
return