Skip to content

Commit

Permalink
robustify tests of iterable_subprocess
Browse files Browse the repository at this point in the history
This commit modifies the test
`test_success_returncode_available_from_generator_with_exception`
to accept `0` and `-15` return codes. The reason is that
any `StopIteration`-exception that occurs before the
subprocess has exited will lead to a subprocess termination
and to a `-15` return code.
There seem to be system configurations in which this
situation appears.

The new test is renamed to
`test_returncode_available_from_generator_with_exception`.
  • Loading branch information
christian-monch committed Feb 2, 2024
1 parent c22e02d commit b83c101
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions datalad_next/iterable_subprocess/test_iterable_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ def test_error_returncode_available_from_generator_with_exception():
assert ls.returncode != 0


def test_success_returncode_available_from_generator_with_exception():
def test_returncode_available_from_generator_with_exception():
with pytest.raises(StopIteration):
with iterable_subprocess(['echo', 'a'], ()) as echo:
while True:
next(echo)
assert echo.returncode == 0
assert echo.returncode in (0, -15)

0 comments on commit b83c101

Please sign in to comment.