diff --git a/tests/test_util.py b/tests/test_util.py index 626c8711..e7c65742 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -157,7 +157,9 @@ def test_py38_support(self): def test_filenotfound(self): exc = FileNotFoundError() exc.filename = "FILENAME" - with mock.patch("importlib.resources.as_file", create=True, side_effect=exc): + with mock.patch("importlib.resources", new=mock.MagicMock( + as_file=mock.MagicMock(side_effect=exc) + )): res = DottedFileNameFinder().get_dotted_filename('tg.tests_test_filenotfound') assert res == os.path.abspath("FILENAME")