[3.12] gh-106300: Improve assertRaises(Exception) usages in tests (GH-106302) (GH-106534)

gh-106300: Improve `assertRaises(Exception)` usages in tests (GH-106302)
(cherry picked from commit 6e6a4cd523)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2023-07-07 14:25:24 -07:00 committed by GitHub
parent 7e883d76c0
commit 2ade2fc148
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 12 deletions

View file

@ -2739,7 +2739,7 @@ class _ZeroCopyFileTest(object):
def test_same_file(self):
self.addCleanup(self.reset)
with self.get_files() as (src, dst):
with self.assertRaises(Exception):
with self.assertRaises((OSError, _GiveupOnFastCopy)):
self.zerocopy_fun(src, src)
# Make sure src file is not corrupted.
self.assertEqual(read_file(TESTFN, binary=True), self.FILEDATA)