Skip to content

Commit 2d7af94

Browse files
Fix tests when zlib is missing
1 parent 617afda commit 2d7af94

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/test/test_ensurepip.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ def setUp(self):
6060
self.run_pip.return_value = 0
6161
self.addCleanup(run_pip_patch.stop)
6262

63+
# Ensure zlib is available for tests (unless specifically testing missing zlib)
64+
zlib_patch = unittest.mock.patch.dict('sys.modules', {'zlib': unittest.mock.MagicMock()})
65+
zlib_patch.start()
66+
self.addCleanup(zlib_patch.stop)
67+
6368
# Avoid side effects on the actual os module
6469
real_devnull = os.devnull
6570
os_patch = unittest.mock.patch("ensurepip.os")

0 commit comments

Comments
 (0)