diff options
author | Eric Lin <anselor@gmail.com> | 2020-07-24 12:21:43 -0400 |
---|---|---|
committer | anselor <anselor@gmail.com> | 2020-08-04 13:38:08 -0400 |
commit | 06cee9126839c465a356f8b44a5f008853eb8cad (patch) | |
tree | 88de1a9f07f20fb6a7e1a8f77b1c48fb41382d19 /tasks.py | |
parent | 787a31931ed4c4a18ae66a570d396b12b2b7b525 (diff) | |
download | cmd2-git-06cee9126839c465a356f8b44a5f008853eb8cad.tar.gz |
updated imports
Added additional documentation
Diffstat (limited to 'tasks.py')
-rw-r--r-- | tasks.py | 27 |
1 files changed, 17 insertions, 10 deletions
@@ -52,21 +52,28 @@ namespace.add_collection(namespace_clean, 'clean') @invoke.task() -def pytest(context, junit=False, pty=True): +def pytest(context, junit=False, pty=True, base=False, isolated=False): """Run tests and code coverage using pytest""" with context.cd(TASK_ROOT_STR): - command_str = 'pytest --cov=cmd2 --cov-report=term --cov-report=html ' + command_str = 'pytest ' + command_str += ' --cov=cmd2 ' + command_str += ' --cov-append --cov-report=term --cov-report=html ' + + if not base and not isolated: + base = True + isolated = True + if junit: command_str += ' --junitxml=junit/test-results.xml ' - tests_cmd = command_str + ' tests' - context.run(tests_cmd, pty=pty) - - command_str += ' --cov-append' - for root, dirnames, _ in os.walk(TASK_ROOT/'isolated_tests'): - for dir in dirnames: - if dir.startswith('test_'): - context.run(command_str + ' isolated_tests/' + dir) + if base: + tests_cmd = command_str + ' tests' + context.run(tests_cmd, pty=pty) + if isolated: + for root, dirnames, _ in os.walk(str(TASK_ROOT/'isolated_tests')): + for dir in dirnames: + if dir.startswith('test_'): + context.run(command_str + ' isolated_tests/' + dir) namespace.add_task(pytest) |