From ed8c25c1e68114bb4fa420efc01c4975a545768f Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Wed, 11 Jan 2023 20:15:31 -0500 Subject: No idea when self.fail worked or didn't. old code is old? --- tests/test_sftp.py | 11 +++-------- 1 file 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) -- cgit v1.2.3