diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2023-01-11 20:15:31 -0500 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2023-01-11 20:15:31 -0500 |
commit | ed8c25c1e68114bb4fa420efc01c4975a545768f (patch) | |
tree | 36a41308f11d178afeb62b3b82d2af8ff22bc56a | |
parent | 7f8262abf6879b80fbb23d835728eb1851ba8a08 (diff) |
No idea when self.fail worked or didn't. old code is old?
-rw-r--r-- | tests/test_sftp.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py index 05d27af8..ab0094be 100644 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -627,11 +627,8 @@ class TestSFTP(object): sftp.open(sftp.FOLDER + "/unusual.txt", "wx").close() try: - try: + with pytest.raises(IOError): sftp.open(sftp.FOLDER + "/unusual.txt", "wx") - self.fail("expected exception") - except IOError: - pass finally: sftp.unlink(sftp.FOLDER + "/unusual.txt") @@ -641,15 +638,13 @@ class TestSFTP(object): """ with sftp.open(sftp.FOLDER + "/something", "w") as f: f.write("okay") - try: sftp.rename( sftp.FOLDER + "/something", sftp.FOLDER + "/" + unicode_folder ) sftp.open(b(sftp.FOLDER) + utf8_folder, "r") - except Exception as e: - self.fail("exception " + str(e)) - sftp.unlink(b(sftp.FOLDER) + utf8_folder) + finally: + sftp.unlink(b(sftp.FOLDER) + utf8_folder) def test_utf8_chdir(self, sftp): sftp.mkdir(sftp.FOLDER + "/" + unicode_folder) |