aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-01-19 12:46:30 -0500
committerJason R. Coombs <jaraco@jaraco.com>2020-01-19 12:46:30 -0500
commit3d4d8b9dde61b87271861b8c7ebeb168ac4fa72b (patch)
treeffbf9cd5a02337ced626892b672b7e21bd305717 /setuptools/tests
parenta0e8d0568d84e29066a5b45aade5aafe28237ec0 (diff)
downloadexternal_python_setuptools-3d4d8b9dde61b87271861b8c7ebeb168ac4fa72b.tar.gz
external_python_setuptools-3d4d8b9dde61b87271861b8c7ebeb168ac4fa72b.tar.bz2
external_python_setuptools-3d4d8b9dde61b87271861b8c7ebeb168ac4fa72b.zip
👹 Feed the hobgoblins (delint).
Diffstat (limited to 'setuptools/tests')
-rw-r--r--setuptools/tests/test_build_meta.py1
-rw-r--r--setuptools/tests/test_dist.py11
-rw-r--r--setuptools/tests/test_easy_install.py77
-rw-r--r--setuptools/tests/test_egg_info.py48
-rw-r--r--setuptools/tests/test_test.py2
-rw-r--r--setuptools/tests/test_virtualenv.py12
-rw-r--r--setuptools/tests/test_wheel.py6
7 files changed, 94 insertions, 63 deletions
diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py
index d68444f6..8fcf3055 100644
--- a/setuptools/tests/test_build_meta.py
+++ b/setuptools/tests/test_build_meta.py
@@ -23,6 +23,7 @@ class BuildBackendBase:
self.env = env
self.backend_name = backend_name
+
class BuildBackend(BuildBackendBase):
"""PEP 517 Build Backend"""
diff --git a/setuptools/tests/test_dist.py b/setuptools/tests/test_dist.py
index 36237f24..b93ef148 100644
--- a/setuptools/tests/test_dist.py
+++ b/setuptools/tests/test_dist.py
@@ -284,7 +284,7 @@ def test_provides_extras_deterministic_order():
dist = Distribution(attrs)
assert dist.metadata.provides_extras == ['b', 'a']
-
+
CHECK_PACKAGE_DATA_TESTS = (
# Valid.
({
@@ -309,7 +309,8 @@ CHECK_PACKAGE_DATA_TESTS = (
({
'hello': str('*.msg'),
}, (
- "\"values of 'package_data' dict\" must be a list of strings (got '*.msg')"
+ "\"values of 'package_data' dict\" "
+ "must be a list of strings (got '*.msg')"
)),
# Invalid value type (generators are single use)
({
@@ -321,10 +322,12 @@ CHECK_PACKAGE_DATA_TESTS = (
)
-@pytest.mark.parametrize('package_data, expected_message', CHECK_PACKAGE_DATA_TESTS)
+@pytest.mark.parametrize(
+ 'package_data, expected_message', CHECK_PACKAGE_DATA_TESTS)
def test_check_package_data(package_data, expected_message):
if expected_message is None:
assert check_package_data(None, 'package_data', package_data) is None
else:
- with pytest.raises(DistutilsSetupError, match=re.escape(expected_message)):
+ with pytest.raises(
+ DistutilsSetupError, match=re.escape(expected_message)):
check_package_data(None, str('package_data'), package_data)
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 2be1be47..30e79fec 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -671,8 +671,10 @@ class TestSetupRequires:
dep_url = path_to_url(dep_sdist, authority='localhost')
test_pkg = create_setup_requires_package(
temp_dir,
- 'python-xlib', '0.19', # Ignored (overriden by setup_attrs).
- setup_attrs=dict(setup_requires='dependency @ %s' % dep_url))
+ # Ignored (overriden by setup_attrs)
+ 'python-xlib', '0.19',
+ setup_attrs=dict(
+ setup_requires='dependency @ %s' % dep_url))
test_setup_py = os.path.join(test_pkg, 'setup.py')
run_setup(test_setup_py, [str('--version')])
assert len(mock_index.requests) == 0
@@ -710,11 +712,14 @@ class TestSetupRequires:
dep_1_0_sdist = 'dep-1.0.tar.gz'
dep_1_0_url = path_to_url(str(tmpdir / dep_1_0_sdist))
dep_1_0_python_requires = '>=2.7'
- make_python_requires_sdist(str(tmpdir / dep_1_0_sdist), 'dep', '1.0', dep_1_0_python_requires)
+ make_python_requires_sdist(
+ str(tmpdir / dep_1_0_sdist), 'dep', '1.0', dep_1_0_python_requires)
dep_2_0_sdist = 'dep-2.0.tar.gz'
dep_2_0_url = path_to_url(str(tmpdir / dep_2_0_sdist))
- dep_2_0_python_requires = '!=' + '.'.join(map(str, sys.version_info[:2])) + '.*'
- make_python_requires_sdist(str(tmpdir / dep_2_0_sdist), 'dep', '2.0', dep_2_0_python_requires)
+ dep_2_0_python_requires = '!=' + '.'.join(
+ map(str, sys.version_info[:2])) + '.*'
+ make_python_requires_sdist(
+ str(tmpdir / dep_2_0_sdist), 'dep', '2.0', dep_2_0_python_requires)
index = tmpdir / 'index.html'
index.write_text(DALS(
'''
@@ -726,7 +731,7 @@ class TestSetupRequires:
<a href="{dep_2_0_url}" data-requires-python="{dep_2_0_python_requires}">{dep_2_0_sdist}</a><br/>
</body>
</html>
- ''').format(
+ ''').format( # noqa
dep_1_0_url=dep_1_0_url,
dep_1_0_sdist=dep_1_0_sdist,
dep_1_0_python_requires=dep_1_0_python_requires,
@@ -738,23 +743,29 @@ class TestSetupRequires:
with contexts.save_pkg_resources_state():
test_pkg = create_setup_requires_package(
str(tmpdir),
- 'python-xlib', '0.19', # Ignored (overriden by setup_attrs).
- setup_attrs=dict(setup_requires='dep', dependency_links=[index_url]))
+ 'python-xlib', '0.19', # Ignored (overriden by setup_attrs).
+ setup_attrs=dict(
+ setup_requires='dep', dependency_links=[index_url]))
test_setup_py = os.path.join(test_pkg, 'setup.py')
run_setup(test_setup_py, [str('--version')])
- eggs = list(map(str, pkg_resources.find_distributions(os.path.join(test_pkg, '.eggs'))))
+ eggs = list(map(str, pkg_resources.find_distributions(
+ os.path.join(test_pkg, '.eggs'))))
assert eggs == ['dep 1.0']
- @pytest.mark.parametrize('use_legacy_installer,with_dependency_links_in_setup_py',
- itertools.product((False, True), (False, True)))
- def test_setup_requires_with_find_links_in_setup_cfg(self, monkeypatch,
- use_legacy_installer,
- with_dependency_links_in_setup_py):
+ @pytest.mark.parametrize(
+ 'use_legacy_installer,with_dependency_links_in_setup_py',
+ itertools.product((False, True), (False, True)))
+ def test_setup_requires_with_find_links_in_setup_cfg(
+ self, monkeypatch, use_legacy_installer,
+ with_dependency_links_in_setup_py):
monkeypatch.setenv(str('PIP_RETRIES'), str('0'))
monkeypatch.setenv(str('PIP_TIMEOUT'), str('0'))
with contexts.save_pkg_resources_state():
with contexts.tempdir() as temp_dir:
- make_trivial_sdist(os.path.join(temp_dir, 'python-xlib-42.tar.gz'), 'python-xlib', '42')
+ make_trivial_sdist(
+ os.path.join(temp_dir, 'python-xlib-42.tar.gz'),
+ 'python-xlib',
+ '42')
test_pkg = os.path.join(temp_dir, 'test_pkg')
test_setup_py = os.path.join(test_pkg, 'setup.py')
test_setup_cfg = os.path.join(test_pkg, 'setup.cfg')
@@ -771,7 +782,7 @@ class TestSetupRequires:
installer.fetch_build_egg = installer._legacy_fetch_build_egg
setup(setup_requires='python-xlib==42',
dependency_links={dependency_links!r})
- ''').format(use_legacy_installer=use_legacy_installer,
+ ''').format(use_legacy_installer=use_legacy_installer, # noqa
dependency_links=dependency_links))
with open(test_setup_cfg, 'w') as fp:
fp.write(DALS(
@@ -783,14 +794,17 @@ class TestSetupRequires:
find_links=temp_dir))
run_setup(test_setup_py, [str('--version')])
- def test_setup_requires_with_transitive_extra_dependency(self, monkeypatch):
+ def test_setup_requires_with_transitive_extra_dependency(
+ self, monkeypatch):
# Use case: installing a package with a build dependency on
# an already installed `dep[extra]`, which in turn depends
# on `extra_dep` (whose is not already installed).
with contexts.save_pkg_resources_state():
with contexts.tempdir() as temp_dir:
# Create source distribution for `extra_dep`.
- make_trivial_sdist(os.path.join(temp_dir, 'extra_dep-1.0.tar.gz'), 'extra_dep', '1.0')
+ make_trivial_sdist(
+ os.path.join(temp_dir, 'extra_dep-1.0.tar.gz'),
+ 'extra_dep', '1.0')
# Create source tree for `dep`.
dep_pkg = os.path.join(temp_dir, 'dep')
os.mkdir(dep_pkg)
@@ -806,12 +820,12 @@ class TestSetupRequires:
'setup.cfg': '',
}, prefix=dep_pkg)
# "Install" dep.
- run_setup(os.path.join(dep_pkg, 'setup.py'), [str('dist_info')])
+ run_setup(
+ os.path.join(dep_pkg, 'setup.py'), [str('dist_info')])
working_set.add_entry(dep_pkg)
# Create source tree for test package.
test_pkg = os.path.join(temp_dir, 'test_pkg')
test_setup_py = os.path.join(test_pkg, 'setup.py')
- test_setup_cfg = os.path.join(test_pkg, 'setup.cfg')
os.mkdir(test_pkg)
with open(test_setup_py, 'w') as fp:
fp.write(DALS(
@@ -881,16 +895,19 @@ def make_nspkg_sdist(dist_path, distname, version):
def make_python_requires_sdist(dist_path, distname, version, python_requires):
make_sdist(dist_path, [
- ('setup.py', DALS("""\
- import setuptools
- setuptools.setup(
- name={name!r},
- version={version!r},
- python_requires={python_requires!r},
- )
- """).format(name=distname, version=version,
- python_requires=python_requires)),
- ('setup.cfg', ''),
+ (
+ 'setup.py',
+ DALS("""\
+ import setuptools
+ setuptools.setup(
+ name={name!r},
+ version={version!r},
+ python_requires={python_requires!r},
+ )
+ """).format(
+ name=distname, version=version,
+ python_requires=python_requires)),
+ ('setup.cfg', ''),
])
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 0db204ba..109f9135 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -525,19 +525,19 @@ class TestEggInfo:
license_file = LICENSE
"""),
'LICENSE': "Test license"
- }, True), # with license
+ }, True), # with license
({
'setup.cfg': DALS("""
[metadata]
license_file = INVALID_LICENSE
"""),
'LICENSE': "Test license"
- }, False), # with an invalid license
+ }, False), # with an invalid license
({
'setup.cfg': DALS("""
"""),
'LICENSE': "Test license"
- }, False), # no license_file attribute
+ }, False), # no license_file attribute
({
'setup.cfg': DALS("""
[metadata]
@@ -545,7 +545,7 @@ class TestEggInfo:
"""),
'MANIFEST.in': "exclude LICENSE",
'LICENSE': "Test license"
- }, False) # license file is manually excluded
+ }, False) # license file is manually excluded
])
def test_setup_cfg_license_file(
self, tmpdir_cwd, env, files, license_in_sources):
@@ -565,7 +565,8 @@ class TestEggInfo:
assert 'LICENSE' in sources_text
else:
assert 'LICENSE' not in sources_text
- assert 'INVALID_LICENSE' not in sources_text # for invalid license test
+ # for invalid license test
+ assert 'INVALID_LICENSE' not in sources_text
@pytest.mark.parametrize("files, incl_licenses, excl_licenses", [
({
@@ -577,7 +578,7 @@ class TestEggInfo:
"""),
'LICENSE-ABC': "ABC license",
'LICENSE-XYZ': "XYZ license"
- }, ['LICENSE-ABC', 'LICENSE-XYZ'], []), # with licenses
+ }, ['LICENSE-ABC', 'LICENSE-XYZ'], []), # with licenses
({
'setup.cfg': DALS("""
[metadata]
@@ -585,7 +586,7 @@ class TestEggInfo:
"""),
'LICENSE-ABC': "ABC license",
'LICENSE-XYZ': "XYZ license"
- }, ['LICENSE-ABC', 'LICENSE-XYZ'], []), # with commas
+ }, ['LICENSE-ABC', 'LICENSE-XYZ'], []), # with commas
({
'setup.cfg': DALS("""
[metadata]
@@ -594,7 +595,7 @@ class TestEggInfo:
"""),
'LICENSE-ABC': "ABC license",
'LICENSE-XYZ': "XYZ license"
- }, ['LICENSE-ABC'], ['LICENSE-XYZ']), # with one license
+ }, ['LICENSE-ABC'], ['LICENSE-XYZ']), # with one license
({
'setup.cfg': DALS("""
[metadata]
@@ -602,7 +603,7 @@ class TestEggInfo:
"""),
'LICENSE-ABC': "ABC license",
'LICENSE-XYZ': "XYZ license"
- }, [], ['LICENSE-ABC', 'LICENSE-XYZ']), # empty
+ }, [], ['LICENSE-ABC', 'LICENSE-XYZ']), # empty
({
'setup.cfg': DALS("""
[metadata]
@@ -610,7 +611,7 @@ class TestEggInfo:
"""),
'LICENSE-ABC': "ABC license",
'LICENSE-XYZ': "XYZ license"
- }, ['LICENSE-XYZ'], ['LICENSE-ABC']), # on same line
+ }, ['LICENSE-XYZ'], ['LICENSE-ABC']), # on same line
({
'setup.cfg': DALS("""
[metadata]
@@ -619,12 +620,12 @@ class TestEggInfo:
INVALID_LICENSE
"""),
'LICENSE-ABC': "Test license"
- }, ['LICENSE-ABC'], ['INVALID_LICENSE']), # with an invalid license
+ }, ['LICENSE-ABC'], ['INVALID_LICENSE']), # with an invalid license
({
'setup.cfg': DALS("""
"""),
'LICENSE': "Test license"
- }, [], ['LICENSE']), # no license_files attribute
+ }, [], ['LICENSE']), # no license_files attribute
({
'setup.cfg': DALS("""
[metadata]
@@ -632,7 +633,7 @@ class TestEggInfo:
"""),
'MANIFEST.in': "exclude LICENSE",
'LICENSE': "Test license"
- }, [], ['LICENSE']), # license file is manually excluded
+ }, [], ['LICENSE']), # license file is manually excluded
({
'setup.cfg': DALS("""
[metadata]
@@ -643,7 +644,7 @@ class TestEggInfo:
'MANIFEST.in': "exclude LICENSE-XYZ",
'LICENSE-ABC': "ABC license",
'LICENSE-XYZ': "XYZ license"
- }, ['LICENSE-ABC'], ['LICENSE-XYZ']) # subset is manually excluded
+ }, ['LICENSE-ABC'], ['LICENSE-XYZ']) # subset is manually excluded
])
def test_setup_cfg_license_files(
self, tmpdir_cwd, env, files, incl_licenses, excl_licenses):
@@ -674,7 +675,7 @@ class TestEggInfo:
"""),
'LICENSE-ABC': "ABC license",
'LICENSE-XYZ': "XYZ license"
- }, [], ['LICENSE-ABC', 'LICENSE-XYZ']), # both empty
+ }, [], ['LICENSE-ABC', 'LICENSE-XYZ']), # both empty
({
'setup.cfg': DALS("""
[metadata]
@@ -684,7 +685,8 @@ class TestEggInfo:
"""),
'LICENSE-ABC': "ABC license",
'LICENSE-XYZ': "XYZ license"
- }, [], ['LICENSE-ABC', 'LICENSE-XYZ']), # license_file is still singular
+ # license_file is still singular
+ }, [], ['LICENSE-ABC', 'LICENSE-XYZ']),
({
'setup.cfg': DALS("""
[metadata]
@@ -696,7 +698,7 @@ class TestEggInfo:
'LICENSE-ABC': "ABC license",
'LICENSE-PQR': "PQR license",
'LICENSE-XYZ': "XYZ license"
- }, ['LICENSE-ABC', 'LICENSE-PQR', 'LICENSE-XYZ'], []), # combined
+ }, ['LICENSE-ABC', 'LICENSE-PQR', 'LICENSE-XYZ'], []), # combined
({
'setup.cfg': DALS("""
[metadata]
@@ -709,7 +711,8 @@ class TestEggInfo:
'LICENSE-ABC': "ABC license",
'LICENSE-PQR': "PQR license",
'LICENSE-XYZ': "XYZ license"
- }, ['LICENSE-ABC', 'LICENSE-PQR', 'LICENSE-XYZ'], []), # duplicate license
+ # duplicate license
+ }, ['LICENSE-ABC', 'LICENSE-PQR', 'LICENSE-XYZ'], []),
({
'setup.cfg': DALS("""
[metadata]
@@ -720,7 +723,8 @@ class TestEggInfo:
'LICENSE-ABC': "ABC license",
'LICENSE-PQR': "PQR license",
'LICENSE-XYZ': "XYZ license"
- }, ['LICENSE-ABC', 'LICENSE-XYZ'], ['LICENSE-PQR']), # combined subset
+ # combined subset
+ }, ['LICENSE-ABC', 'LICENSE-XYZ'], ['LICENSE-PQR']),
({
'setup.cfg': DALS("""
[metadata]
@@ -730,7 +734,8 @@ class TestEggInfo:
LICENSE-PQR
"""),
'LICENSE-PQR': "Test license"
- }, ['LICENSE-PQR'], ['LICENSE-ABC', 'LICENSE-XYZ']), # with invalid licenses
+ # with invalid licenses
+ }, ['LICENSE-PQR'], ['LICENSE-ABC', 'LICENSE-XYZ']),
({
'setup.cfg': DALS("""
[metadata]
@@ -743,7 +748,8 @@ class TestEggInfo:
'LICENSE-ABC': "ABC license",
'LICENSE-PQR': "PQR license",
'LICENSE-XYZ': "XYZ license"
- }, ['LICENSE-XYZ'], ['LICENSE-ABC', 'LICENSE-PQR']) # manually excluded
+ # manually excluded
+ }, ['LICENSE-XYZ'], ['LICENSE-ABC', 'LICENSE-PQR'])
])
def test_setup_cfg_license_file_license_files(
self, tmpdir_cwd, env, files, incl_licenses, excl_licenses):
diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py
index 6242a018..8ee70a7e 100644
--- a/setuptools/tests/test_test.py
+++ b/setuptools/tests/test_test.py
@@ -12,7 +12,7 @@ from setuptools.command.test import test
from setuptools.dist import Distribution
from .textwrap import DALS
-from . import contexts
+
SETUP_PY = DALS("""
from setuptools import setup
diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py
index 2c35825a..b009fbd6 100644
--- a/setuptools/tests/test_virtualenv.py
+++ b/setuptools/tests/test_virtualenv.py
@@ -8,8 +8,6 @@ from pytest_fixture_config import yield_requires_config
import pytest_virtualenv
-from setuptools.extern import six
-
from .textwrap import DALS
from .test_easy_install import make_nspkg_sdist
@@ -64,7 +62,7 @@ def _get_pip_versions():
from urllib.request import urlopen
from urllib.error import URLError
except ImportError:
- from urllib2 import urlopen, URLError # Python 2.7 compat
+ from urllib2 import urlopen, URLError # Python 2.7 compat
try:
urlopen('https://pypi.org', timeout=1)
@@ -180,12 +178,16 @@ def _check_test_command_install_requirements(virtualenv, tmpdir):
)).format(tmpdir=tmpdir))
assert tmpdir.join('success').check()
+
def test_test_command_install_requirements(virtualenv, tmpdir):
# Ensure pip/wheel packages are installed.
- virtualenv.run("python -c \"__import__('pkg_resources').require(['pip', 'wheel'])\"")
+ virtualenv.run(
+ "python -c \"__import__('pkg_resources').require(['pip', 'wheel'])\"")
_check_test_command_install_requirements(virtualenv, tmpdir)
-def test_test_command_install_requirements_when_using_easy_install(bare_virtualenv, tmpdir):
+
+def test_test_command_install_requirements_when_using_easy_install(
+ bare_virtualenv, tmpdir):
_check_test_command_install_requirements(bare_virtualenv, tmpdir)
diff --git a/setuptools/tests/test_wheel.py b/setuptools/tests/test_wheel.py
index 55d346c6..39eb06ee 100644
--- a/setuptools/tests/test_wheel.py
+++ b/setuptools/tests/test_wheel.py
@@ -455,7 +455,8 @@ WHEEL_INSTALL_TESTS = (
id='empty_namespace_package',
file_defs={
'foobar': {
- '__init__.py': "__import__('pkg_resources').declare_namespace(__name__)",
+ '__init__.py':
+ "__import__('pkg_resources').declare_namespace(__name__)",
},
},
setup_kwargs=dict(
@@ -579,4 +580,5 @@ def test_wheel_is_compatible(monkeypatch):
for t in parse_tag('cp36-cp36m-manylinux1_x86_64'):
yield t
monkeypatch.setattr('setuptools.wheel.sys_tags', sys_tags)
- assert Wheel('onnxruntime-0.1.2-cp36-cp36m-manylinux1_x86_64.whl').is_compatible()
+ assert Wheel(
+ 'onnxruntime-0.1.2-cp36-cp36m-manylinux1_x86_64.whl').is_compatible()