Skip to content

bpo-41490: Update ensurepip to install pip 20.2.1 and setuptools 49.2.1 #21748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build_msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- 3.7
paths:
- 'Tools/msi/**'
- 'Lib/ensurepip/**'
pull_request:
branches:
- master
Expand All @@ -17,6 +18,7 @@ on:
- 3.7
paths:
- 'Tools/msi/**'
- 'Lib/ensurepip/**'

jobs:
build_win32:
Expand Down
2 changes: 1 addition & 1 deletion Lib/ensurepip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
__all__ = ["version", "bootstrap"]


_SETUPTOOLS_VERSION = "47.1.0"
_SETUPTOOLS_VERSION = "49.2.1"

_PIP_VERSION = "20.2.3"

Expand Down
Binary file not shown.
Binary file not shown.
69 changes: 69 additions & 0 deletions Lib/test/test_importlib/test_resource.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import sys
import unittest
import uuid

from . import data01
from . import zipdata01, zipdata02
from . import util
from importlib import resources, import_module
from pathlib import Path
from test.support import import_helper, unlink
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unlink should now be imported from test.support.os_helper.



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


class DeletingZipsTest(unittest.TestCase):
"""Having accessed resources in a zip file should not keep an open
reference to the zip.
"""
ZIP_MODULE = zipdata01

def setUp(self):
modules = import_helper.modules_setup()
self.addCleanup(import_helper.modules_cleanup, *modules)

data_path = Path(self.ZIP_MODULE.__file__)
data_dir = data_path.parent
self.source_zip_path = data_dir / 'ziptestdata.zip'
self.zip_path = Path.cwd() / '{}.zip'.format(uuid.uuid4())
self.zip_path.write_bytes(self.source_zip_path.read_bytes())
sys.path.append(str(self.zip_path))
self.data = import_module('ziptestdata')

def tearDown(self):
try:
sys.path.remove(str(self.zip_path))
except ValueError:
pass

try:
del sys.path_importer_cache[str(self.zip_path)]
del sys.modules[self.data.__name__]
except KeyError:
pass

try:
unlink(self.zip_path)
except OSError:
# If the test fails, this will probably fail too
pass

def test_contents_does_not_keep_open(self):
c = resources.contents('ziptestdata')
self.zip_path.unlink()

def test_is_resource_does_not_keep_open(self):
c = resources.is_resource('ziptestdata', 'binary.file')
self.zip_path.unlink()

def test_is_resource_failure_does_not_keep_open(self):
c = resources.is_resource('ziptestdata', 'not-present')
self.zip_path.unlink()

def test_path_does_not_keep_open(self):
c = resources.path('ziptestdata', 'binary.file')
self.zip_path.unlink()

def test_entered_path_does_not_keep_open(self):
# This is what certifi does on import to make its bundle
# available for the process duration.
c = resources.path('ziptestdata', 'binary.file').__enter__()
self.zip_path.unlink()

def test_read_binary_does_not_keep_open(self):
c = resources.read_binary('ziptestdata', 'binary.file')
self.zip_path.unlink()

def test_read_text_does_not_keep_open(self):
c = resources.read_text('ziptestdata', 'utf-8.file', encoding='utf-8')
self.zip_path.unlink()

if __name__ == '__main__':
unittest.main()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update :mod:`ensurepip` to install pip 20.2.1 and setuptools 49.2.1.