diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2020-02-11 22:15:31 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-02-11 22:15:31 -0500 |
commit | ce8e3ee174ed9dee84aa08a461fb174ac1e53535 (patch) | |
tree | da78c024b4491210e61b73e9e2f755d46c8bc1ff /setuptools/tests/test_virtualenv.py | |
parent | 53b8523fdfa19173d2e6b11d6b4d175f54b9dfea (diff) | |
parent | a5dec2f14e3414e4ee5dd146bff9c289d573de9a (diff) | |
download | external_python_setuptools-ce8e3ee174ed9dee84aa08a461fb174ac1e53535.tar.gz external_python_setuptools-ce8e3ee174ed9dee84aa08a461fb174ac1e53535.tar.bz2 external_python_setuptools-ce8e3ee174ed9dee84aa08a461fb174ac1e53535.zip |
Merge branch 'master' into fix/1557
Diffstat (limited to 'setuptools/tests/test_virtualenv.py')
-rw-r--r-- | setuptools/tests/test_virtualenv.py | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py index d7b98c77..6549a6c0 100644 --- a/setuptools/tests/test_virtualenv.py +++ b/setuptools/tests/test_virtualenv.py @@ -13,6 +13,17 @@ from .test_easy_install import make_nspkg_sdist @pytest.fixture(autouse=True) +def disable_requires_python(monkeypatch): + """ + Disable Requires-Python on Python 2.7 + """ + if sys.version_info > (3,): + return + + monkeypatch.setenv('PIP_IGNORE_REQUIRES_PYTHON', 'true') + + +@pytest.fixture(autouse=True) def pytest_virtualenv_works(virtualenv): """ pytest_virtualenv may not work. if it doesn't, skip these @@ -62,7 +73,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) @@ -116,14 +127,12 @@ def test_pip_upgrade_from_source(pip_version, virtualenv): virtualenv.run('pip install --no-cache-dir --upgrade ' + sdist) -def test_test_command_install_requirements(bare_virtualenv, tmpdir): +def _check_test_command_install_requirements(virtualenv, tmpdir): """ Check the test command will install all required dependencies. """ - bare_virtualenv.run(' && '.join(( - 'cd {source}', - 'python setup.py develop', - )).format(source=SOURCE_DIR)) + # Install setuptools. + virtualenv.run('python setup.py develop', cd=SOURCE_DIR) def sdist(distname, version): dist_path = tmpdir.join('%s-%s.tar.gz' % (distname, version)) @@ -174,13 +183,25 @@ def test_test_command_install_requirements(bare_virtualenv, tmpdir): open('success', 'w').close() ''')) # Run test command for test package. - bare_virtualenv.run(' && '.join(( + virtualenv.run(' && '.join(( 'cd {tmpdir}', 'python setup.py test -s test', )).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'])\"") + _check_test_command_install_requirements(virtualenv, tmpdir) + + +def test_test_command_install_requirements_when_using_easy_install( + bare_virtualenv, tmpdir): + _check_test_command_install_requirements(bare_virtualenv, tmpdir) + + def test_no_missing_dependencies(bare_virtualenv): """ Quick and dirty test to ensure all external dependencies are vendored. |