Skip to content

Commit 0cce6a4

Browse files
committed
bpo-41490: Update ensurepip to install pip 20.2.1 and setuptools 49.2.1
1 parent 95ad890 commit 0cce6a4

File tree

6 files changed

+73
-1
lines changed

6 files changed

+73
-1
lines changed

.github/workflows/build_msi.yml

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- 3.7
1010
paths:
1111
- 'Tools/msi/**'
12+
- 'Lib/ensurepip/**'
1213
pull_request:
1314
branches:
1415
- master
@@ -17,6 +18,7 @@ on:
1718
- 3.7
1819
paths:
1920
- 'Tools/msi/**'
21+
- 'Lib/ensurepip/**'
2022

2123
jobs:
2224
build_win32:

Lib/ensurepip/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
__all__ = ["version", "bootstrap"]
1414

1515

16-
_SETUPTOOLS_VERSION = "47.1.0"
16+
_SETUPTOOLS_VERSION = "49.2.1"
1717

1818
_PIP_VERSION = "20.2.3"
1919

Binary file not shown.

Lib/test/test_importlib/test_resource.py

+69
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import sys
22
import unittest
3+
import uuid
34

45
from . import data01
56
from . import zipdata01, zipdata02
67
from . import util
78
from importlib import resources, import_module
9+
from pathlib import Path
10+
from test.support import import_helper, unlink
811

912

1013
class ResourceTests:
@@ -162,5 +165,71 @@ def test_namespaces_cannot_have_resources(self):
162165
'test.test_importlib.data03.namespace', 'resource1.txt')
163166

164167

168+
class DeletingZipsTest(unittest.TestCase):
169+
"""Having accessed resources in a zip file should not keep an open
170+
reference to the zip.
171+
"""
172+
ZIP_MODULE = zipdata01
173+
174+
def setUp(self):
175+
modules = import_helper.modules_setup()
176+
self.addCleanup(import_helper.modules_cleanup, *modules)
177+
178+
data_path = Path(self.ZIP_MODULE.__file__)
179+
data_dir = data_path.parent
180+
self.source_zip_path = data_dir / 'ziptestdata.zip'
181+
self.zip_path = Path.cwd() / '{}.zip'.format(uuid.uuid4())
182+
self.zip_path.write_bytes(self.source_zip_path.read_bytes())
183+
sys.path.append(str(self.zip_path))
184+
self.data = import_module('ziptestdata')
185+
186+
def tearDown(self):
187+
try:
188+
sys.path.remove(str(self.zip_path))
189+
except ValueError:
190+
pass
191+
192+
try:
193+
del sys.path_importer_cache[str(self.zip_path)]
194+
del sys.modules[self.data.__name__]
195+
except KeyError:
196+
pass
197+
198+
try:
199+
unlink(self.zip_path)
200+
except OSError:
201+
# If the test fails, this will probably fail too
202+
pass
203+
204+
def test_contents_does_not_keep_open(self):
205+
c = resources.contents('ziptestdata')
206+
self.zip_path.unlink()
207+
208+
def test_is_resource_does_not_keep_open(self):
209+
c = resources.is_resource('ziptestdata', 'binary.file')
210+
self.zip_path.unlink()
211+
212+
def test_is_resource_failure_does_not_keep_open(self):
213+
c = resources.is_resource('ziptestdata', 'not-present')
214+
self.zip_path.unlink()
215+
216+
def test_path_does_not_keep_open(self):
217+
c = resources.path('ziptestdata', 'binary.file')
218+
self.zip_path.unlink()
219+
220+
def test_entered_path_does_not_keep_open(self):
221+
# This is what certifi does on import to make its bundle
222+
# available for the process duration.
223+
c = resources.path('ziptestdata', 'binary.file').__enter__()
224+
self.zip_path.unlink()
225+
226+
def test_read_binary_does_not_keep_open(self):
227+
c = resources.read_binary('ziptestdata', 'binary.file')
228+
self.zip_path.unlink()
229+
230+
def test_read_text_does_not_keep_open(self):
231+
c = resources.read_text('ziptestdata', 'utf-8.file', encoding='utf-8')
232+
self.zip_path.unlink()
233+
165234
if __name__ == '__main__':
166235
unittest.main()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update :mod:`ensurepip` to install pip 20.2.1 and setuptools 49.2.1.

0 commit comments

Comments
 (0)