Skip to content

Commit

Permalink
Tests: Fix flaky work chain tests using recwarn fixture (#6112)
Browse files Browse the repository at this point in the history
The tests were often failing because the `recwarn` fixture contained
two records instead of one. The reason is that elsewhere in the code a
`ResourceWarning` is emitted because an event-loop is not closed when
another one is created. Until this is fixed, the assertion is updated to
not check for the number of warnings emitted, but specifically to check
the expected warning message is present.
  • Loading branch information
sphuber committed Sep 5, 2023
1 parent 8e6e08d commit 2071517
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/engine/test_work_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def run_step(self):
pass

launch.run(TestWorkChain)
assert len(recwarn) == 1
assert any('The conditional predicate `predicate` returned `true`' in str(r.message) for r in recwarn)

def test_invalid_while_predicate(self, recwarn):
"""Test that workchain raises if the predicate of an ``while_`` condition does not return a boolean."""
Expand All @@ -553,7 +553,7 @@ def run_step(self):
return ExitCode(1)

launch.run(TestWorkChain)
assert len(recwarn) == 1
assert any('The conditional predicate `predicate` returned `true`' in str(r.message) for r in recwarn)

def test_malformed_outline(self):
"""
Expand Down

0 comments on commit 2071517

Please sign in to comment.