diff options
Diffstat (limited to 'setuptools/tests/test_integration.py')
-rw-r--r-- | setuptools/tests/test_integration.py | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py index 3a9a6c50..f1a27f8b 100644 --- a/setuptools/tests/test_integration.py +++ b/setuptools/tests/test_integration.py @@ -6,6 +6,11 @@ Try to install a few packages. import glob import os import sys +import re +import subprocess +import functools +import tarfile +import zipfile from setuptools.extern.six.moves import urllib import pytest @@ -59,7 +64,7 @@ def install_context(request, tmpdir, monkeypatch): monkeypatch.setattr('site.USER_BASE', user_base.strpath) monkeypatch.setattr('site.USER_SITE', user_site.strpath) monkeypatch.setattr('sys.path', sys.path + [install_dir.strpath]) - monkeypatch.setenv('PYTHONPATH', os.path.pathsep.join(sys.path)) + monkeypatch.setenv(str('PYTHONPATH'), str(os.path.pathsep.join(sys.path))) # Set up the command for performing the installation. dist = Distribution() @@ -114,15 +119,12 @@ def test_pyuri(install_context): assert os.path.exists(os.path.join(pyuri.location, 'pyuri', 'uri.regex')) -import re -import subprocess -import functools -import tarfile, zipfile +build_deps = ['appdirs', 'packaging', 'pyparsing', 'six'] -build_deps = ['appdirs', 'packaging', 'pyparsing', 'six'] @pytest.mark.parametrize("build_dep", build_deps) -@pytest.mark.skipif(sys.version_info < (3, 6), reason='run only on late versions') +@pytest.mark.skipif( + sys.version_info < (3, 6), reason='run only on late versions') def test_build_deps_on_distutils(request, tmpdir_factory, build_dep): """ All setuptools build dependencies must build without @@ -139,7 +141,9 @@ def test_build_deps_on_distutils(request, tmpdir_factory, build_dep): allowed_unknowns = [ 'test_suite', 'tests_require', + 'python_requires', 'install_requires', + 'long_description_content_type', ] assert not match or match.group(1).strip('"\'') in allowed_unknowns @@ -147,15 +151,18 @@ def test_build_deps_on_distutils(request, tmpdir_factory, build_dep): def install(pkg_dir, install_dir): with open(os.path.join(pkg_dir, 'setuptools.py'), 'w') as breaker: breaker.write('raise ImportError()') - cmd = [sys.executable, 'setup.py', 'install', '--prefix', install_dir] - env = dict(os.environ, PYTHONPATH=pkg_dir) - output = subprocess.check_output(cmd, cwd=pkg_dir, env=env, stderr=subprocess.STDOUT) + cmd = [sys.executable, 'setup.py', 'install', '--prefix', str(install_dir)] + env = dict(os.environ, PYTHONPATH=str(pkg_dir)) + output = subprocess.check_output( + cmd, cwd=pkg_dir, env=env, stderr=subprocess.STDOUT) return output.decode('utf-8') def download_and_extract(request, req, target): - cmd = [sys.executable, '-m', 'pip', 'download', '--no-deps', - '--no-binary', ':all:', req] + cmd = [ + sys.executable, '-m', 'pip', 'download', '--no-deps', + '--no-binary', ':all:', req, + ] output = subprocess.check_output(cmd, encoding='utf-8') filename = re.search('Saved (.*)', output).group(1) request.addfinalizer(functools.partial(os.remove, filename)) |