diff options
-rw-r--r-- | tasks.py | 17 | ||||
-rw-r--r-- | tests/test_auth.py | 2 | ||||
-rw-r--r-- | tests/test_client.py | 2 | ||||
-rw-r--r-- | tests/test_sftp.py | 3 | ||||
-rw-r--r-- | tests/test_sftp_big.py | 3 | ||||
-rw-r--r-- | tests/test_transport.py | 4 | ||||
-rw-r--r-- | tests/util.py | 3 |
7 files changed, 28 insertions, 6 deletions
@@ -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 |