diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_client.py | 5 | ||||
-rw-r--r-- | tests/test_gssapi.py | 7 | ||||
-rw-r--r-- | tests/test_sftp.py | 28 |
3 files changed, 39 insertions, 1 deletions
diff --git a/tests/test_client.py b/tests/test_client.py index 60ad310c..f14aac23 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -421,7 +421,10 @@ class SSHClientTest(ClientTest): # force a collection to see whether the SSHClient object is deallocated # 2 GCs are needed on PyPy, time is needed for Python 3 - time.sleep(0.3) + # TODO: this still fails randomly under CircleCI under Python 3.7, 3.8 + # at the very least. bumped sleep 0.3->1.0s but the underlying + # functionality should get reevaluated once we drop Python 2. + time.sleep(1) gc.collect() gc.collect() diff --git a/tests/test_gssapi.py b/tests/test_gssapi.py index 308caa93..acdc7c82 100644 --- a/tests/test_gssapi.py +++ b/tests/test_gssapi.py @@ -26,6 +26,13 @@ import socket from .util import needs_gssapi, KerberosTestCase, update_env +# +# NOTE: KerberosTestCase skips all tests if it was unable to import k5test +# third-party library. That's the primary trigger for whether this module +# effectively gets run or not. See tests/util.py for other triggers (a set of +# env vars a human might have defined). +# + @needs_gssapi class GSSAPITest(KerberosTestCase): diff --git a/tests/test_sftp.py b/tests/test_sftp.py index e4e18e5a..a98a46c6 100644 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -554,6 +554,34 @@ class TestSFTP(object): os.unlink(localname) sftp.unlink(sftp.FOLDER + "/bunny.txt") + def test_get_without_prefetch(self, sftp): + """ + Create a 4MB file. Verify that pull works without prefetching + using a lager file. + """ + + sftp_filename = sftp.FOLDER + "/dummy_file" + num_chars = 1024 * 1024 * 4 + + fd, localname = mkstemp() + os.close(fd) + + with open(localname, "wb") as f: + f.write(b"0" * num_chars) + + sftp.put(localname, sftp_filename) + + os.unlink(localname) + fd, localname = mkstemp() + os.close(fd) + + sftp.get(sftp_filename, localname, prefetch=False) + + assert os.stat(localname).st_size == num_chars + + os.unlink(localname) + sftp.unlink(sftp_filename) + def test_check(self, sftp): """ verify that file.check() works against our own server. |