diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/loop.py | 2 | ||||
-rw-r--r-- | tests/test_channelfile.py | 4 | ||||
-rw-r--r-- | tests/test_config.py | 22 | ||||
-rw-r--r-- | tests/test_kex.py | 6 | ||||
-rw-r--r-- | tests/test_proxy.py | 2 | ||||
-rw-r--r-- | tests/test_sftp.py | 2 | ||||
-rw-r--r-- | tests/test_sftp_big.py | 2 | ||||
-rw-r--r-- | tests/util.py | 2 |
8 files changed, 21 insertions, 21 deletions
diff --git a/tests/loop.py b/tests/loop.py index 51dc6308..a3740013 100644 --- a/tests/loop.py +++ b/tests/loop.py @@ -22,7 +22,7 @@ import threading from paramiko.util import asbytes -class LoopSocket(object): +class LoopSocket: """ A LoopSocket looks like a normal socket, but all data written to it is delivered on the read-end of another LoopSocket, and vice versa. It's diff --git a/tests/test_channelfile.py b/tests/test_channelfile.py index 65929416..e2b6306c 100644 --- a/tests/test_channelfile.py +++ b/tests/test_channelfile.py @@ -3,7 +3,7 @@ from unittest.mock import patch, MagicMock from paramiko import Channel, ChannelFile, ChannelStderrFile, ChannelStdinFile -class ChannelFileBase(object): +class ChannelFileBase: @patch("paramiko.channel.ChannelFile._set_mode") def test_defaults_to_unbuffered_reading(self, setmode): self.klass(Channel(None)) @@ -31,7 +31,7 @@ class TestChannelFile(ChannelFileBase): klass = ChannelFile -class TestChannelStderrFile(object): +class TestChannelStderrFile: def test_read_calls_channel_recv_stderr(self): chan = MagicMock() cf = ChannelStderrFile(chan) diff --git a/tests/test_config.py b/tests/test_config.py index 67a03e63..2fd875e8 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -52,7 +52,7 @@ def load_config(name): return SSHConfig.from_path(_config(name)) -class TestSSHConfig(object): +class TestSSHConfig: def setup(self): self.config = load_config("robey") @@ -511,7 +511,7 @@ Host * assert result["hostname"] == "prefix.whatever" -class TestSSHConfigDict(object): +class TestSSHConfigDict: def test_SSHConfigDict_construct_empty(self): assert not SSHConfigDict() @@ -570,7 +570,7 @@ Host * assert config.lookup("anything-else").as_int("port") == 3333 -class TestHostnameCanonicalization(object): +class TestHostnameCanonicalization: # NOTE: this class uses on-disk configs, and ones with real (at time of # writing) DNS names, so that one can easily test OpenSSH's behavior using # "ssh -F path/to/file.config -G <target>". @@ -669,7 +669,7 @@ class TestHostnameCanonicalization(object): @mark.skip -class TestCanonicalizationOfCNAMEs(object): +class TestCanonicalizationOfCNAMEs: def test_permitted_cnames_may_be_one_to_one_mapping(self): # CanonicalizePermittedCNAMEs *.foo.com:*.bar.com pass @@ -695,7 +695,7 @@ class TestCanonicalizationOfCNAMEs(object): pass -class TestMatchAll(object): +class TestMatchAll: def test_always_matches(self): result = load_config("match-all").lookup("general") assert result["user"] == "awesome" @@ -745,7 +745,7 @@ def _expect(success_on): @mark.skipif(Result is None, reason="requires invoke package") -class TestMatchExec(object): +class TestMatchExec: @patch("paramiko.config.invoke", new=None) @patch("paramiko.config.invoke_import_error", new=ImportError("meh")) def test_raises_invoke_ImportErrors_at_runtime(self): @@ -825,7 +825,7 @@ class TestMatchExec(object): assert result["hostname"] == "pingable.target" -class TestMatchHost(object): +class TestMatchHost: def test_matches_target_name_when_no_hostname(self): result = load_config("match-host").lookup("target") assert result["user"] == "rand" @@ -875,7 +875,7 @@ class TestMatchHost(object): load_config("match-host-no-arg") -class TestMatchOriginalHost(object): +class TestMatchOriginalHost: def test_matches_target_host_not_hostname(self): result = load_config("match-orighost").lookup("target") assert result["hostname"] == "bogus" @@ -908,7 +908,7 @@ class TestMatchOriginalHost(object): load_config("match-orighost-no-arg") -class TestMatchUser(object): +class TestMatchUser: def test_matches_configured_username(self): result = load_config("match-user-explicit").lookup("anything") assert result["hostname"] == "dumb" @@ -955,7 +955,7 @@ class TestMatchUser(object): # NOTE: highly derivative of previous suite due to the former's use of # localuser fallback. Doesn't seem worth conflating/refactoring right now. -class TestMatchLocalUser(object): +class TestMatchLocalUser: @patch("paramiko.config.getpass.getuser") def test_matches_local_username(self, getuser): getuser.return_value = "gandalf" @@ -996,7 +996,7 @@ class TestMatchLocalUser(object): load_config("match-localuser-no-arg") -class TestComplexMatching(object): +class TestComplexMatching: # NOTE: this is still a cherry-pick of a few levels of complexity, there's # no point testing literally all possible combinations. diff --git a/tests/test_kex.py b/tests/test_kex.py index 45a691f2..c3bf2b0f 100644 --- a/tests/test_kex.py +++ b/tests/test_kex.py @@ -69,7 +69,7 @@ def dummy_generate_key_pair(obj): ) -class FakeKey(object): +class FakeKey: def __str__(self): return "fake-key" @@ -80,7 +80,7 @@ class FakeKey(object): return b"fake-sig" -class FakeModulusPack(object): +class FakeModulusPack: P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF # noqa G = 2 @@ -88,7 +88,7 @@ class FakeModulusPack(object): return self.G, self.P -class FakeTransport(object): +class FakeTransport: local_version = "SSH-2.0-paramiko_1.0" remote_version = "SSH-2.0-lame" local_kex_init = "local-kex-init" diff --git a/tests/test_proxy.py b/tests/test_proxy.py index d50cc562..83bdc040 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -7,7 +7,7 @@ from pytest import raises from paramiko import ProxyCommand, ProxyCommandFailure -class TestProxyCommand(object): +class TestProxyCommand: @patch("paramiko.proxy.subprocess") def test_init_takes_command_string(self, subprocess): ProxyCommand(command_line="do a thing") diff --git a/tests/test_sftp.py b/tests/test_sftp.py index 5767c00b..2cd68d94 100644 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -93,7 +93,7 @@ utf8_folder = b"/\xc3\xbcnic\xc3\xb8\x64\x65" @slow -class TestSFTP(object): +class TestSFTP: def test_file(self, sftp): """ verify that we can create a file. diff --git a/tests/test_sftp_big.py b/tests/test_sftp_big.py index d2d30f24..5f55a6fc 100644 --- a/tests/test_sftp_big.py +++ b/tests/test_sftp_big.py @@ -34,7 +34,7 @@ from .util import slow @slow -class TestBigSFTP(object): +class TestBigSFTP: def test_lots_of_files(self, sftp): """ create a bunch of files over the same session. diff --git a/tests/util.py b/tests/util.py index 79ce2c61..0639f8ae 100644 --- a/tests/util.py +++ b/tests/util.py @@ -61,7 +61,7 @@ if ( ): # add other vars as needed # The environment provides the required information - class DummyK5Realm(object): + class DummyK5Realm: def __init__(self): for k in os.environ: if not k.startswith("K5TEST_"): |