Commit d327617
authored
Fixes #1201
# Description
Print stderr and stdout message when example in ``test_examples.py``
fails.
It will print a message like:
```
@pytest.mark.parametrize("example", get_examples())
def test_example(example):
result = subprocess.run([sys.executable, example], capture_output=True)
if result.returncode != 0:
> raise RuntimeError(
f"Example failed to run with returncode: {result.returncode} \n\n"
f"stdout: {result.stdout.decode()} \n\n"
f"stderr: {result.stderr.decode()} \n\n"
)
E RuntimeError: Example failed to run with returncode: 1
E
E stdout:
E
E stderr: Unzipping contents of 'C:\Users\Herman\AppData\Local\imod\imod\Cache\hondsrug-simulation.zip' to 'C:\Users\Herman\AppData\Local\Temp\tmpkhwjabqu\hondsrug_saved'
E Traceback (most recent call last):
E File "c:\src\imod-python\examples\mf6\hondsrug_partitioning.py", line 52, in <module>
E raise ValueError("Some failure")
E ValueError: Some failure
```
# Checklist
- [x] Links to correct issue
- [ ] Update changelog, if changes affect users
- [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737``
- [ ] Unit tests were added
- [ ] **If feature added**: Added/extended example
1 parent 434e534 commit d327617
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments