From 4efb4f7281b9b4598b31b72711cd1f3b178d3469 Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Sat, 21 Mar 2020 16:40:23 +0100 Subject: [PATCH 1/2] bpo-40029 mark test_importlib.test_zip as requiring zlib --- Lib/test/test_importlib/test_zip.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/test_importlib/test_zip.py b/Lib/test/test_importlib/test_zip.py index 9568c226af033d..a15756e460d18a 100644 --- a/Lib/test/test_importlib/test_zip.py +++ b/Lib/test/test_importlib/test_zip.py @@ -7,6 +7,8 @@ ) from importlib.resources import path +from test.support import requires_zlib + class TestZip(unittest.TestCase): root = 'test.test_importlib.data' @@ -21,6 +23,7 @@ def setUp(self): sys.path.insert(0, str(wheel)) self.resources.callback(sys.path.pop, 0) + @requires_zlib def test_zip_version(self): self.assertEqual(version('example'), '21.12') @@ -28,6 +31,7 @@ def test_zip_version_does_not_match(self): with self.assertRaises(PackageNotFoundError): version('definitely-not-installed') + @requires_zlib def test_zip_entry_points(self): scripts = dict(entry_points()['console_scripts']) entry_point = scripts['example'] @@ -38,9 +42,11 @@ def test_zip_entry_points(self): def test_missing_metadata(self): self.assertIsNone(distribution('example').read_text('does not exist')) + @requires_zlib def test_case_insensitive(self): self.assertEqual(version('Example'), '21.12') + @requires_zlib def test_files(self): for file in files('example'): path = str(file.dist.locate_file(file)) @@ -58,6 +64,7 @@ def setUp(self): sys.path.insert(0, str(egg)) self.resources.callback(sys.path.pop, 0) + @requires_zlib def test_files(self): for file in files('example'): path = str(file.dist.locate_file(file)) From 1387bece09ef40fadf25c9e6990a89c609d46231 Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Tue, 24 Mar 2020 17:44:22 +0100 Subject: [PATCH 2/2] Decorate TestZip / TestEgg classes as requiring zlib --- Lib/test/test_importlib/test_zip.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_importlib/test_zip.py b/Lib/test/test_importlib/test_zip.py index a15756e460d18a..9466ca4a5f424d 100644 --- a/Lib/test/test_importlib/test_zip.py +++ b/Lib/test/test_importlib/test_zip.py @@ -10,6 +10,7 @@ from test.support import requires_zlib +@requires_zlib class TestZip(unittest.TestCase): root = 'test.test_importlib.data' @@ -23,7 +24,6 @@ def setUp(self): sys.path.insert(0, str(wheel)) self.resources.callback(sys.path.pop, 0) - @requires_zlib def test_zip_version(self): self.assertEqual(version('example'), '21.12') @@ -31,7 +31,6 @@ def test_zip_version_does_not_match(self): with self.assertRaises(PackageNotFoundError): version('definitely-not-installed') - @requires_zlib def test_zip_entry_points(self): scripts = dict(entry_points()['console_scripts']) entry_point = scripts['example'] @@ -42,17 +41,16 @@ def test_zip_entry_points(self): def test_missing_metadata(self): self.assertIsNone(distribution('example').read_text('does not exist')) - @requires_zlib def test_case_insensitive(self): self.assertEqual(version('Example'), '21.12') - @requires_zlib def test_files(self): for file in files('example'): path = str(file.dist.locate_file(file)) assert '.whl/' in path, path +@requires_zlib class TestEgg(TestZip): def setUp(self): # Find the path to the example-*.egg so we can add it to the front of @@ -64,7 +62,6 @@ def setUp(self): sys.path.insert(0, str(egg)) self.resources.callback(sys.path.pop, 0) - @requires_zlib def test_files(self): for file in files('example'): path = str(file.dist.locate_file(file))