Skip to content

Commit

Permalink
Tests with subprocess should capture streams (#164)
Browse files Browse the repository at this point in the history
## Context

Not all tests using subprocess would capture std streams. This means
pytest could not handle their output properly.
Fixes #51

## Scope
Make all tests using subprocess capture std streams.

## Testing
CI

## Review
* [x] PR description is complete
* [x] Coding style (imports, function length, New functions, classes or
files) are good
* [ ] Unit/Scientific test added
* [ ] Updated Readme, in-code, developer documentation
  • Loading branch information
ferdonline authored May 17, 2024
1 parent df963fd commit 906173e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/integration-e2e/test_cli_opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ def test_save_restore_cli():
# Save-Restore raises exception when using NEURON
if simulator == "NEURON":
with pytest.raises(subprocess.CalledProcessError):
subprocess.run(command, check=True)
subprocess.run(command, check=True, capture_output=True)
else:
subprocess.run(command, check=True)
subprocess.run(command, check=True, capture_output=True)


def test_cli_prcellgid():
Expand Down Expand Up @@ -70,6 +70,7 @@ def test_cli_disable_reports():
subprocess.run(
["neurodamus", CONFIG_FILE_MINI, "--disable-reports"],
check=True,
capture_output=True,
cwd=test_folder_path
)
# Spikes are present even if we disable reports
Expand All @@ -81,6 +82,7 @@ def test_cli_disable_reports():
subprocess.run(
["neurodamus", CONFIG_FILE_MINI],
check=True,
capture_output=True,
cwd=test_folder_path
)
assert (test_folder_path / sim_config_data["output"]["output_dir"] / "out.h5").is_file()
Expand Down
1 change: 1 addition & 0 deletions tests/integration-e2e/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,5 @@ def test_run_acell_circuit():
["bash", "tests/test_simulation.bash", str(simdir), "BlueConfig", ""],
env=env,
check=True,
capture_output=True,
)

0 comments on commit 906173e

Please sign in to comment.