Skip to content

Commit 5851b85

Browse files
committed
Add exit codes to CLI to pytest
1 parent c2d51af commit 5851b85

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.github/workflows/test_dedalus3.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@ jobs:
5353
shell: bash -l {0}
5454
run: |
5555
conda activate dedalus3
56+
cd ~
5657
python3 -m dedalus test

dedalus/__main__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
if __name__ == "__main__":
1717

18+
import sys
1819
import pathlib
1920
import shutil
2021
import tarfile
@@ -24,11 +25,11 @@
2425

2526
args = docopt(__doc__)
2627
if args['test']:
27-
test()
28+
sys.exit(test())
2829
elif args['bench']:
29-
bench()
30+
sys.exit(bench())
3031
elif args['cov']:
31-
cov()
32+
sys.exit(cov())
3233
elif args['get_config']:
3334
config_path = pathlib.Path(__file__).parent.joinpath('dedalus.cfg')
3435
shutil.copy(str(config_path), '.')

dedalus/tests/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
def test():
1111
"""Run tests."""
12-
pytest.main(["-k", "not ncc", "--workers=auto", "--benchmark-disable", str(root)])
12+
return pytest.main(["-k", "not ncc", "--workers=auto", "--benchmark-disable", str(root)])
1313

1414
def bench():
1515
"""Run benchmarks."""
16-
pytest.main(["-k", "not ncc", "--workers=auto", "--benchmark-only", str(root)])
16+
return pytest.main(["-k", "not ncc", "--workers=auto", "--benchmark-only", str(root)])
1717

1818
def cov():
1919
"""Print test coverage."""
20-
pytest.main(["-k", "not ncc", "--workers=auto", "--benchmark-disable", "--cov=dedalus.core", str(root)])
20+
return pytest.main(["-k", "not ncc", "--workers=auto", "--benchmark-disable", "--cov=dedalus.core", str(root)])

0 commit comments

Comments
 (0)