Skip to content

Commit

Permalink
Runner: Close event loop in Runner.close()
Browse files Browse the repository at this point in the history
This prevents leaving open event loops which cause `ResourceWarnings` to
be emitted during tests.
  • Loading branch information
sphuber committed Feb 13, 2024
1 parent 06e39d7 commit 97e9f30
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/aiida/engine/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def close(self) -> None:
"""Close the runner by stopping the loop."""
assert not self._closed
self.stop()
if not self._loop.is_running():
self._loop.close()
reset_event_loop_policy()
self._closed = True

Expand Down

0 comments on commit 97e9f30

Please sign in to comment.