summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2017-11-21 18:21:36 -0800
committerJeff Forcier <jeff@bitprophet.org>2017-12-31 16:10:47 -0500
commit59f0f26ed4ad85db2307373900ee68310f7d6e13 (patch)
tree183fac2b926d494c9e826fb1f7a3fbf265f233e1
parent03f61d23719b2269110f042973475ab3a31b83a3 (diff)
downloadparamiko-59f0f26ed4ad85db2307373900ee68310f7d6e13.tar.gz
Update to pytest-relaxed 1.1.0 and prep for using it
Thus, we can use our legacy suite and newer relaxed-style stuff at the same time. TOOT TOOT
-rw-r--r--dev-requirements.txt2
-rw-r--r--setup.cfg4
-rw-r--r--tasks.py11
-rw-r--r--tests/_loop.py (renamed from tests/loop.py)0
-rw-r--r--tests/_stub_sftp.py (renamed from tests/stub_sftp.py)0
-rw-r--r--tests/_util.py (renamed from tests/util.py)0
-rw-r--r--tests/conftest.py6
-rw-r--r--tests/test_auth.py4
-rw-r--r--tests/test_client.py2
-rw-r--r--tests/test_file.py2
-rw-r--r--tests/test_gssapi.py2
-rw-r--r--tests/test_kex_gss.py2
-rw-r--r--tests/test_packetizer.py2
-rw-r--r--tests/test_pkey.py2
-rw-r--r--tests/test_sftp.py6
-rw-r--r--tests/test_sftp_big.py2
-rw-r--r--tests/test_ssh_gss.py2
-rw-r--r--tests/test_transport.py4
18 files changed, 28 insertions, 25 deletions
diff --git a/dev-requirements.txt b/dev-requirements.txt
index 00ff1c6e..27cd91b6 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -8,4 +8,4 @@ wheel==0.24
twine==1.9.1
flake8==2.6.2
pytest==3.2.1
-pytest_relaxed==1.0.0
+pytest_relaxed==1.1.0
diff --git a/setup.cfg b/setup.cfg
index 00e34ca3..6419a805 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -13,6 +13,4 @@ ignore = E124,E125,E128,E261,E301,E302,E303,E402
max-line-length = 79
[tool:pytest]
-# We use pytest-relaxed just for its utils at the moment, so disable it at the
-# plugin level until we adapt test organization to really use it.
-addopts = -p no:relaxed
+testpaths = tests
diff --git a/tasks.py b/tasks.py
index d5ed25b1..d2f4db4c 100644
--- a/tasks.py
+++ b/tasks.py
@@ -1,5 +1,5 @@
import os
-from os.path import join
+from os.path import join, exists
from shutil import rmtree, copytree
from invoke import Collection, task
@@ -46,8 +46,13 @@ def test(
opts += ' -x'
modstr = ""
if module is not None:
- # NOTE: implicit test_ prefix as we're not on pytest-relaxed yet
- modstr = " tests/test_{}.py".format(module)
+ # Fall back to test_*.py for the legacy parts of the suite
+ path = "tests/{}.py".format(module)
+ if not exists(path):
+ path = "tests/test_{}.py".format(module)
+ if not exists(path):
+ sys.exit("There's no '{}' to test!".format(path))
+ modstr = " {}".format(path)
# Switch runner depending on coverage or no coverage.
# TODO: get pytest's coverage plugin working, IIRC it has issues?
runner = "pytest"
diff --git a/tests/loop.py b/tests/_loop.py
index 6c432867..6c432867 100644
--- a/tests/loop.py
+++ b/tests/_loop.py
diff --git a/tests/stub_sftp.py b/tests/_stub_sftp.py
index 19545865..19545865 100644
--- a/tests/stub_sftp.py
+++ b/tests/_stub_sftp.py
diff --git a/tests/util.py b/tests/_util.py
index 4ca02374..4ca02374 100644
--- a/tests/util.py
+++ b/tests/_util.py
diff --git a/tests/conftest.py b/tests/conftest.py
index d1967a73..93b9fe98 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -6,9 +6,9 @@ import threading
import pytest
from paramiko import RSAKey, SFTPServer, SFTP, Transport
-from .loop import LoopSocket
-from .stub_sftp import StubServer, StubSFTPServer
-from .util import _support
+from ._loop import LoopSocket
+from ._stub_sftp import StubServer, StubSFTPServer
+from ._util import _support
# TODO: not a huge fan of conftest.py files, see if we can move these somewhere
diff --git a/tests/test_auth.py b/tests/test_auth.py
index b47f75d3..0b90634b 100644
--- a/tests/test_auth.py
+++ b/tests/test_auth.py
@@ -32,8 +32,8 @@ from paramiko import (
from paramiko import AUTH_FAILED, AUTH_PARTIALLY_SUCCESSFUL, AUTH_SUCCESSFUL
from paramiko.py3compat import u
-from .loop import LoopSocket
-from .util import _support, slow
+from ._loop import LoopSocket
+from ._util import _support, slow
# TODO: see what other tests in other modules might want to move in here
diff --git a/tests/test_client.py b/tests/test_client.py
index 7163fdcf..75da3b85 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -40,7 +40,7 @@ from paramiko.pkey import PublicBlob
from paramiko.common import PY2
from paramiko.ssh_exception import SSHException, AuthenticationException
-from .util import _support, slow
+from ._util import _support, slow
requires_gss_auth = unittest.skipUnless(
diff --git a/tests/test_file.py b/tests/test_file.py
index 3d2c94e6..86d24476 100644
--- a/tests/test_file.py
+++ b/tests/test_file.py
@@ -27,7 +27,7 @@ from paramiko.common import linefeed_byte, crlf, cr_byte
from paramiko.file import BufferedFile
from paramiko.py3compat import BytesIO
-from .util import needs_builtin
+from ._util import needs_builtin
class LoopbackFile (BufferedFile):
diff --git a/tests/test_gssapi.py b/tests/test_gssapi.py
index d4b632be..583532bc 100644
--- a/tests/test_gssapi.py
+++ b/tests/test_gssapi.py
@@ -25,7 +25,7 @@ Test the used APIs for GSS-API / SSPI authentication
import unittest
import socket
-from .util import needs_gssapi
+from ._util import needs_gssapi
@needs_gssapi
diff --git a/tests/test_kex_gss.py b/tests/test_kex_gss.py
index 025d1faa..a4f6a65c 100644
--- a/tests/test_kex_gss.py
+++ b/tests/test_kex_gss.py
@@ -31,7 +31,7 @@ import unittest
import paramiko
-from .util import needs_gssapi
+from ._util import needs_gssapi
class NullServer (paramiko.ServerInterface):
diff --git a/tests/test_packetizer.py b/tests/test_packetizer.py
index 414b7e38..c477cb70 100644
--- a/tests/test_packetizer.py
+++ b/tests/test_packetizer.py
@@ -30,7 +30,7 @@ from cryptography.hazmat.primitives.ciphers import algorithms, Cipher, modes
from paramiko import Message, Packetizer, util
from paramiko.common import byte_chr, zero_byte
-from .loop import LoopSocket
+from ._loop import LoopSocket
x55 = byte_chr(0x55)
diff --git a/tests/test_pkey.py b/tests/test_pkey.py
index 1827d2a9..c76aa854 100644
--- a/tests/test_pkey.py
+++ b/tests/test_pkey.py
@@ -30,7 +30,7 @@ import base64
from paramiko import RSAKey, DSSKey, ECDSAKey, Ed25519Key, Message, util
from paramiko.py3compat import StringIO, byte_chr, b, bytes, PY2
-from .util import _support
+from ._util import _support
# from openssh's ssh-keygen
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index 09a50453..d4c0df77 100644
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -40,9 +40,9 @@ from paramiko.py3compat import PY2, b, u, StringIO
from paramiko.common import o777, o600, o666, o644
from paramiko.sftp_attr import SFTPAttributes
-from .util import needs_builtin
-from .stub_sftp import StubServer, StubSFTPServer
-from .util import _support, slow
+from ._util import needs_builtin
+from ._stub_sftp import StubServer, StubSFTPServer
+from ._util import _support, slow
ARTICLE = '''
diff --git a/tests/test_sftp_big.py b/tests/test_sftp_big.py
index a659098d..a54a10cc 100644
--- a/tests/test_sftp_big.py
+++ b/tests/test_sftp_big.py
@@ -32,7 +32,7 @@ import unittest
from paramiko.common import o660
-from .util import slow
+from ._util import slow
@slow
diff --git a/tests/test_ssh_gss.py b/tests/test_ssh_gss.py
index f0645e0e..06bdb211 100644
--- a/tests/test_ssh_gss.py
+++ b/tests/test_ssh_gss.py
@@ -29,7 +29,7 @@ import unittest
import paramiko
-from .util import _support, needs_gssapi
+from ._util import _support, needs_gssapi
from .test_client import FINGERPRINTS
diff --git a/tests/test_transport.py b/tests/test_transport.py
index 00639d04..48355deb 100644
--- a/tests/test_transport.py
+++ b/tests/test_transport.py
@@ -44,8 +44,8 @@ from paramiko.common import (
from paramiko.py3compat import bytes
from paramiko.message import Message
-from .util import needs_builtin, _support, slow
-from .loop import LoopSocket
+from ._util import needs_builtin, _support, slow
+from ._loop import LoopSocket
LONG_BANNER = """\