aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2019-08-17 19:14:48 -0700
committerAnthony Sottile <asottile@umich.edu>2019-08-17 19:18:07 -0700
commit43add1d3f5138e38adc4940647cc6eae94fb6123 (patch)
tree5be3b39a6b43a82ddf113b948484d0e1b75458e7
parent2cd2fdcb69426de4bb9d63d638244f4ae6a1ca27 (diff)
downloadexternal_python_setuptools-43add1d3f5138e38adc4940647cc6eae94fb6123.tar.gz
external_python_setuptools-43add1d3f5138e38adc4940647cc6eae94fb6123.tar.bz2
external_python_setuptools-43add1d3f5138e38adc4940647cc6eae94fb6123.zip
Fixes for python3.10
-rw-r--r--changelog.d/1824.change.rst1
-rw-r--r--pkg_resources/__init__.py2
-rw-r--r--pkg_resources/api_tests.txt2
-rw-r--r--pkg_resources/tests/test_resources.py2
-rwxr-xr-xsetup.py2
-rw-r--r--setuptools/command/bdist_egg.py2
-rw-r--r--setuptools/command/easy_install.py6
-rw-r--r--setuptools/package_index.py2
-rw-r--r--setuptools/tests/test_bdist_egg.py2
9 files changed, 11 insertions, 10 deletions
diff --git a/changelog.d/1824.change.rst b/changelog.d/1824.change.rst
new file mode 100644
index 00000000..5f609036
--- /dev/null
+++ b/changelog.d/1824.change.rst
@@ -0,0 +1 @@
+Fix tests when running under ``python3.10``.
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 1f170cfd..fb68813e 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -333,7 +333,7 @@ class UnknownExtra(ResolutionError):
_provider_factories = {}
-PY_MAJOR = sys.version[:3]
+PY_MAJOR = '{}.{}'.format(*sys.version_info)
EGG_DIST = 3
BINARY_DIST = 2
SOURCE_DIST = 1
diff --git a/pkg_resources/api_tests.txt b/pkg_resources/api_tests.txt
index 0a75170e..7ae5a038 100644
--- a/pkg_resources/api_tests.txt
+++ b/pkg_resources/api_tests.txt
@@ -36,7 +36,7 @@ Distributions have various introspectable attributes::
>>> dist.version
'0.9'
- >>> dist.py_version == sys.version[:3]
+ >>> dist.py_version == '{}.{}'.format(*sys.version_info)
True
>>> print(dist.platform)
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index 86afcf74..7063ed3d 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -116,7 +116,7 @@ class TestDistro:
self.checkFooPkg(d)
d = Distribution("/some/path")
- assert d.py_version == sys.version[:3]
+ assert d.py_version == '{}.{}'.format(*sys.version_info)
assert d.platform is None
def testDistroParse(self):
diff --git a/setup.py b/setup.py
index f5030dd6..d97895fc 100755
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,7 @@ def _gen_console_scripts():
if any(os.environ.get(var) not in (None, "", "0") for var in var_names):
return
tmpl = "easy_install-{shortver} = setuptools.command.easy_install:main"
- yield tmpl.format(shortver=sys.version[:3])
+ yield tmpl.format(shortver='{}.{}'.format(*sys.version_info))
package_data = dict(
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index 9f8df917..98470f17 100644
--- a/setuptools/command/bdist_egg.py
+++ b/setuptools/command/bdist_egg.py
@@ -284,7 +284,7 @@ class bdist_egg(Command):
"or refer to a module" % (ep,)
)
- pyver = sys.version[:3]
+ pyver = '{}.{}'.format(*sys.version_info)
pkg = ep.module_name
full = '.'.join(ep.attrs)
base = ep.attrs[0]
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 06c98271..593ed777 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -241,7 +241,7 @@ class easy_install(Command):
"""
Render the Setuptools version and installation details, then exit.
"""
- ver = sys.version[:3]
+ ver = '{}.{}'.format(*sys.version_info)
dist = get_distribution('setuptools')
tmpl = 'setuptools {dist.version} from {dist.location} (Python {ver})'
print(tmpl.format(**locals()))
@@ -1412,7 +1412,7 @@ def get_site_dirs():
os.path.join(
prefix,
"lib",
- "python" + sys.version[:3],
+ "python{}.{}".format(*sys.version_info),
"site-packages",
),
os.path.join(prefix, "lib", "site-python"),
@@ -1433,7 +1433,7 @@ def get_site_dirs():
home,
'Library',
'Python',
- sys.version[:3],
+ '{}.{}'.format(*sys.version_info),
'site-packages',
)
sitedirs.append(home_sp)
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 6b06f2ca..f419d471 100644
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -46,7 +46,7 @@ __all__ = [
_SOCKET_TIMEOUT = 15
_tmpl = "setuptools/{setuptools.__version__} Python-urllib/{py_major}"
-user_agent = _tmpl.format(py_major=sys.version[:3], setuptools=setuptools)
+user_agent = _tmpl.format(py_major='{}.{}'.format(*sys.version_info), setuptools=setuptools)
def parse_requirement_arg(spec):
diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index 54742aa6..fb5b90b1 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -42,7 +42,7 @@ class Test:
# let's see if we got our egg link at the right place
[content] = os.listdir('dist')
- assert re.match(r'foo-0.0.0-py[23].\d.egg$', content)
+ assert re.match(r'foo-0.0.0-py[23].\d+.egg$', content)
@pytest.mark.xfail(
os.environ.get('PYTHONDONTWRITEBYTECODE'),