summaryrefslogtreecommitdiff
path: root/tasks.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2017-10-23 11:42:47 -0700
committerJeff Forcier <jeff@bitprophet.org>2017-10-23 11:42:47 -0700
commit71ca2b0022a10f6ba0c6647c5c68581ef9779fd0 (patch)
treed5ca572b5f56e4dafecaf4f1c136fc74862c36bb /tasks.py
parent8f7b894eb3b50a08007e6e98dc4f3424dc1d32c4 (diff)
downloadparamiko-71ca2b0022a10f6ba0c6647c5c68581ef9779fd0.tar.gz
Remove references to test.py, including overhaul of test tasks
Diffstat (limited to 'tasks.py')
-rw-r--r--tasks.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/tasks.py b/tasks.py
index a45b4efc..78420164 100644
--- a/tasks.py
+++ b/tasks.py
@@ -8,26 +8,32 @@ from invocations.packaging.release import ns as release_coll, publish
from invocations.testing import count_errors
-# Until we move to spec-based testing
@task
-def test(ctx, coverage=False, flags=""):
- if "--verbose" not in flags.split():
- flags += " --verbose"
- runner = "python"
+def test(ctx, verbose=True, coverage=False, opts=""):
+ # TODO: once pytest coverage plugin works, see if there's a pytest-native
+ # way to handle the env stuff too, then we can remove these tasks entirely
+ # in favor of just "run pytest"?
+ if verbose:
+ opts += " --verbose"
+ runner = "pytest"
if coverage:
- runner = "coverage run --source=paramiko"
+ # Leverage how pytest can be run as 'python -m pytest', and then how
+ # coverage can be told to run things in that manner instead of
+ # expecting a literal .py file.
+ # TODO: get pytest's coverage plugin working, IIRC it has issues?
+ runner = "coverage run --source=paramiko -m pytest"
# Strip SSH_AUTH_SOCK from parent env to avoid pollution by interactive
# users.
env = dict(os.environ)
if 'SSH_AUTH_SOCK' in env:
del env['SSH_AUTH_SOCK']
- cmd = "{} test.py {}".format(runner, flags)
+ cmd = "{} {}".format(runner, opts)
ctx.run(cmd, pty=True, env=env, replace_env=True)
@task
-def coverage(ctx):
- ctx.run("coverage run --source=paramiko test.py --verbose")
+def coverage(ctx, opts=""):
+ return test(ctx, coverage=True, opts=opts)
# Until we stop bundling docs w/ releases. Need to discover use cases first.