summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2017-10-23 11:42:47 -0700
committerJeff Forcier <jeff@bitprophet.org>2018-09-17 14:37:22 -0700
commit2fb5b0a36719c13bb2b044d9a2034408d18310eb (patch)
tree8bbd6e4ef7baf202ad30d1a968968d390d339f03
parent8ea387e95c2a0d704a0117bb8217b79213b64ebe (diff)
downloadparamiko-2fb5b0a36719c13bb2b044d9a2034408d18310eb.tar.gz
Remove references to test.py, including overhaul of test tasks
-rw-r--r--MANIFEST.in2
-rw-r--r--README.rst3
-rw-r--r--tasks.py31
3 files changed, 25 insertions, 11 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index e718ea24..1eec2054 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,4 @@
-include LICENSE test.py setup_helper.py
+include LICENSE setup_helper.py
recursive-include docs *
recursive-include tests *.py *.key
recursive-include demos *.py *.key user_rsa_key user_rsa_key.pub
diff --git a/README.rst b/README.rst
index 399dceb9..2f24a0a9 100644
--- a/README.rst
+++ b/README.rst
@@ -132,6 +132,7 @@ doc/ folder.
There are also unit tests here::
- $ python ./test.py
+ $ pip install -r dev-requirements.txt
+ $ pytest
Which will verify that most of the core components are working correctly.
diff --git a/tasks.py b/tasks.py
index 42c18bd0..d232fa9b 100644
--- a/tasks.py
+++ b/tasks.py
@@ -1,3 +1,4 @@
+import os
from os.path import join
from shutil import rmtree, copytree
@@ -6,20 +7,32 @@ from invocations.docs import docs, www, sites
from invocations.packaging.release import ns as release_coll, publish
-# 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"
- ctx.run("{0} test.py {1}".format(runner, flags), pty=True)
+ # 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 = "{} {}".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.