diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2017-10-25 11:42:19 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2017-10-25 11:42:19 -0700 |
commit | b7df94b8a419f7ed949421d22896286dc1b15233 (patch) | |
tree | 254d67fa37996ebc76f33430763dce37a3b262b1 /tasks.py | |
parent | 4f85487b02bd7fc845f1c0726b9ec2a7703d7631 (diff) |
Mark known slow tests as 'slow' pytest marker, and skip them by default
Diffstat (limited to 'tasks.py')
-rw-r--r-- | tasks.py | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -9,9 +9,19 @@ from invocations.testing import count_errors @task -def test(ctx, verbose=True, coverage=False, opts=""): +def test(ctx, verbose=True, coverage=False, include_slow=False, opts=""): + """ + Run unit tests via pytest. + + By default, known-slow parts of the suite are SKIPPED unless + ``--include-slow`` is given. (Note that ``--include-slow`` does not mesh + well with explicit ``--opts="-m=xxx"`` - if ``-m`` is found in ``--opts``, + ``--include-slow`` will be ignored!) + """ if verbose and '--verbose' not in opts and '-v' not in opts: opts += " --verbose" + if '-m' not in opts and not include_slow: + opts += " -m 'not slow'" runner = "pytest" if coverage: # Leverage how pytest can be run as 'python -m pytest', and then how @@ -34,7 +44,10 @@ def test(ctx, verbose=True, coverage=False, opts=""): @task def coverage(ctx, opts=""): - return test(ctx, coverage=True, opts=opts) + """ + Execute all tests (normal and slow) with coverage enabled. + """ + return test(ctx, coverage=True, include_slow=True, opts=opts) # Until we stop bundling docs w/ releases. Need to discover use cases first. |