Skip to content

Commit 171ff7c

Browse files
committed
Add optional test reporting
1 parent 5851b85 commit 171ff7c

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

dedalus/__main__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
Dedalus module interface.
33
44
Usage:
5-
dedalus test
5+
dedalus test [--report]
66
dedalus bench
77
dedalus cov
88
dedalus get_config
99
dedalus get_examples
1010
11-
Options:
12-
--cleanup Delete distributed files after merging
13-
1411
"""
1512

1613
if __name__ == "__main__":
@@ -25,7 +22,7 @@
2522

2623
args = docopt(__doc__)
2724
if args['test']:
28-
sys.exit(test())
25+
sys.exit(test(report=args['--report']))
2926
elif args['bench']:
3027
sys.exit(bench())
3128
elif args['cov']:

dedalus/tests/__init__.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,27 @@
66

77
file = pathlib.Path(__file__)
88
root = file.parent
9+
testpath = str(root)
910

10-
def test():
11+
def base_cmd():
12+
return ["-k", "not ncc", "--workers=auto"]
13+
14+
def test(report=False):
1115
"""Run tests."""
12-
return pytest.main(["-k", "not ncc", "--workers=auto", "--benchmark-disable", str(root)])
16+
cmd = base_cmd()
17+
cmd.extend(["--benchmark-disable"])
18+
if report:
19+
cmd.append("--junitxml=dedalus-test-junit.xml")
20+
return pytest.main(cmd + [testpath])
1321

1422
def bench():
1523
"""Run benchmarks."""
16-
return pytest.main(["-k", "not ncc", "--workers=auto", "--benchmark-only", str(root)])
24+
cmd = base_cmd()
25+
cmd.extend(["--benchmark-only"])
26+
return pytest.main(cmd + [testpath])
1727

1828
def cov():
1929
"""Print test coverage."""
20-
return pytest.main(["-k", "not ncc", "--workers=auto", "--benchmark-disable", "--cov=dedalus.core", str(root)])
30+
cmd = base_cmd()
31+
cmd.extend(["--benchmark-disable", "--cov=dedalus.core"])
32+
return pytest.main(cmd + [testpath])

0 commit comments

Comments
 (0)