summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2017-10-25 11:42:19 -0700
committerJeff Forcier <jeff@bitprophet.org>2018-09-17 14:50:02 -0700
commit1fa48b482c2db097da2b69dcaa79b3f7db98f1f0 (patch)
treeb0fa3635fbf146013f293ba95fa86597b89de4d4
parent6b377c0e33c5d3443883de770a03cdb53140d07c (diff)
downloadparamiko-1fa48b482c2db097da2b69dcaa79b3f7db98f1f0.tar.gz
Mark known slow tests as 'slow' pytest marker, and skip them by default
-rw-r--r--tasks.py17
-rw-r--r--tests/test_auth.py2
-rw-r--r--tests/test_client.py2
-rw-r--r--tests/test_sftp.py3
-rw-r--r--tests/test_sftp_big.py3
-rw-r--r--tests/test_transport.py4
-rw-r--r--tests/util.py3
7 files changed, 28 insertions, 6 deletions
diff --git a/tasks.py b/tasks.py
index 97dca66b..6053ce1b 100644
--- a/tasks.py
+++ b/tasks.py
@@ -8,9 +8,19 @@ from invocations.packaging.release import ns as release_coll, publish
@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
@@ -33,7 +43,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.
diff --git a/tests/test_auth.py b/tests/test_auth.py
index 9ca48947..e9c75fd5 100644
--- a/tests/test_auth.py
+++ b/tests/test_auth.py
@@ -32,7 +32,7 @@ from paramiko import AUTH_FAILED, AUTH_PARTIALLY_SUCCESSFUL, AUTH_SUCCESSFUL
from paramiko.py3compat import u
from .loop import LoopSocket
-from .util import _support
+from .util import _support, slow
_pwd = u('\u2022')
diff --git a/tests/test_client.py b/tests/test_client.py
index b5fe2e06..597c278e 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -37,7 +37,7 @@ import paramiko
from paramiko.py3compat import PY2, b
from paramiko.ssh_exception import SSHException
-from .util import _support
+from .util import _support, slow
FINGERPRINTS = {
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index ac0d17fb..dac54a9b 100644
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -42,7 +42,7 @@ from paramiko.sftp_attr import SFTPAttributes
from .util import needs_builtin
from .stub_sftp import StubServer, StubSFTPServer
-from .util import _support
+from .util import _support, slow
ARTICLE = '''
@@ -88,6 +88,7 @@ unicode_folder = u'\u00fcnic\u00f8de' if PY2 else '\u00fcnic\u00f8de'
utf8_folder = b'/\xc3\xbcnic\xc3\xb8\x64\x65'
+@slow
class TestSFTP(object):
def test_1_file(self, sftp):
"""
diff --git a/tests/test_sftp_big.py b/tests/test_sftp_big.py
index e5708312..a659098d 100644
--- a/tests/test_sftp_big.py
+++ b/tests/test_sftp_big.py
@@ -32,7 +32,10 @@ import unittest
from paramiko.common import o660
+from .util import slow
+
+@slow
class TestBigSFTP(object):
def test_1_lots_of_files(self, sftp):
"""
diff --git a/tests/test_transport.py b/tests/test_transport.py
index 7fa67c43..9474acfc 100644
--- a/tests/test_transport.py
+++ b/tests/test_transport.py
@@ -44,7 +44,7 @@ from paramiko.common import (
from paramiko.py3compat import bytes
from paramiko.message import Message
-from .util import needs_builtin, _support
+from .util import needs_builtin, _support, slow
from .loop import LoopSocket
@@ -257,6 +257,7 @@ class TransportTest(unittest.TestCase):
self.tc.renegotiate_keys()
self.ts.send_ignore(1024)
+ @slow
def test_5_keepalive(self):
"""
verify that the keepalive will be sent.
@@ -820,6 +821,7 @@ class TransportTest(unittest.TestCase):
(2**32, MAX_WINDOW_SIZE)]:
self.assertEqual(self.tc._sanitize_window_size(val), correct)
+ @slow
def test_L_handshake_timeout(self):
"""
verify that we can get a hanshake timeout.
diff --git a/tests/util.py b/tests/util.py
index 051a36ba..4ca02374 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -22,3 +22,6 @@ def needs_builtin(name):
"""
reason = "Test requires a builtin '{}'".format(name)
return pytest.mark.skipif(not hasattr(builtins, name), reason=reason)
+
+
+slow = pytest.mark.slow