mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
e521228129
=================================== FAILURES =================================== _______________________________ test_freeze_path _______________________________ tmpdir = Path('/tmp/pytest-of-mockbuild/pytest-0/test_freeze_path0') script = <tests.lib.PipTestEnvironment object at 0x7fe950a4caf0> data = <tests.lib.TestData object at 0x7fe950a4cc10> def test_freeze_path(tmpdir, script, data): """ Test freeze with --path. """ > script.pip('install', '--find-links', data.find_links, '--target', tmpdir, 'simple==2.0') tests/functional/test_freeze.py:712: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/lib/__init__.py:593: in run _check_stderr( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ stderr = "WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'N...t at 0x7fe6435ef280>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/\n" allow_stderr_warning = False, allow_stderr_error = False def _check_stderr( stderr, allow_stderr_warning, allow_stderr_error, ): """ Check the given stderr for logged warnings and errors. :param stderr: stderr output as a string. :param allow_stderr_warning: whether a logged warning (or deprecation message) is allowed. Must be True if allow_stderr_error is True. :param allow_stderr_error: whether a logged error is allowed. """ assert not (allow_stderr_error and not allow_stderr_warning) lines = stderr.splitlines() for line in lines: # First check for logging errors, which we don't allow during # tests even if allow_stderr_error=True (since a logging error # would signal a bug in pip's code). # Unlike errors logged with logger.error(), these errors are # sent directly to stderr and so bypass any configured log formatter. # The "--- Logging error ---" string is used in Python 3.4+, and # "Logged from file " is used in Python 2. if (line.startswith('--- Logging error ---') or line.startswith('Logged from file ')): reason = 'stderr has a logging error, which is never allowed' msg = make_check_stderr_message(stderr, line=line, reason=reason) raise RuntimeError(msg) if allow_stderr_error: continue if line.startswith('ERROR: '): reason = ( 'stderr has an unexpected error ' '(pass allow_stderr_error=True to permit this)' ) msg = make_check_stderr_message(stderr, line=line, reason=reason) raise RuntimeError(msg) if allow_stderr_warning: continue if (line.startswith('WARNING: ') or line.startswith(DEPRECATION_MSG_PREFIX)): reason = ( 'stderr has an unexpected warning ' '(pass allow_stderr_warning=True to permit this)' ) msg = make_check_stderr_message(stderr, line=line, reason=reason) > raise RuntimeError(msg) E RuntimeError: stderr has an unexpected warning (pass allow_stderr_warning=True to permit this): E Caused by line: "WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe64364c850>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/" E Complete stderr: WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe64364c850>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe64364cdc0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe64364cf70>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe6435ef130>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe6435ef280>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ tests/lib/__init__.py:404: RuntimeError ________________________ test_freeze_path_exclude_user _________________________ tmpdir = Path('/tmp/pytest-of-mockbuild/pytest-0/test_freeze_path_exclude_user0') script = <tests.lib.PipTestEnvironment object at 0x7fe950ec8fa0> data = <tests.lib.TestData object at 0x7fe950ec8a30> def test_freeze_path_exclude_user(tmpdir, script, data): """ Test freeze with --path and make sure packages from --user are not picked up. """ script.pip_install_local('--find-links', data.find_links, '--user', 'simple2') > script.pip('install', '--find-links', data.find_links, '--target', tmpdir, 'simple==1.0') tests/functional/test_freeze.py:728: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/lib/__init__.py:593: in run _check_stderr( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ stderr = "WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'N...t at 0x7f87ae751310>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/\n" allow_stderr_warning = False, allow_stderr_error = False def _check_stderr( stderr, allow_stderr_warning, allow_stderr_error, ): """ Check the given stderr for logged warnings and errors. :param stderr: stderr output as a string. :param allow_stderr_warning: whether a logged warning (or deprecation message) is allowed. Must be True if allow_stderr_error is True. :param allow_stderr_error: whether a logged error is allowed. """ assert not (allow_stderr_error and not allow_stderr_warning) lines = stderr.splitlines() for line in lines: # First check for logging errors, which we don't allow during # tests even if allow_stderr_error=True (since a logging error # would signal a bug in pip's code). # Unlike errors logged with logger.error(), these errors are # sent directly to stderr and so bypass any configured log formatter. # The "--- Logging error ---" string is used in Python 3.4+, and # "Logged from file " is used in Python 2. if (line.startswith('--- Logging error ---') or line.startswith('Logged from file ')): reason = 'stderr has a logging error, which is never allowed' msg = make_check_stderr_message(stderr, line=line, reason=reason) raise RuntimeError(msg) if allow_stderr_error: continue if line.startswith('ERROR: '): reason = ( 'stderr has an unexpected error ' '(pass allow_stderr_error=True to permit this)' ) msg = make_check_stderr_message(stderr, line=line, reason=reason) raise RuntimeError(msg) if allow_stderr_warning: continue if (line.startswith('WARNING: ') or line.startswith(DEPRECATION_MSG_PREFIX)): reason = ( 'stderr has an unexpected warning ' '(pass allow_stderr_warning=True to permit this)' ) msg = make_check_stderr_message(stderr, line=line, reason=reason) > raise RuntimeError(msg) E RuntimeError: stderr has an unexpected warning (pass allow_stderr_warning=True to permit this): E Caused by line: "WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f87ae7aa8e0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/" E Complete stderr: WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f87ae7aa8e0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f87ae7aae50>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f87ae751040>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f87ae7511c0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f87ae751310>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ tests/lib/__init__.py:404: RuntimeError __________________________ test_freeze_path_multiple ___________________________ tmpdir = Path('/tmp/pytest-of-mockbuild/pytest-0/test_freeze_path_multiple0') script = <tests.lib.PipTestEnvironment object at 0x7fe950b43fd0> data = <tests.lib.TestData object at 0x7fe950b43df0> def test_freeze_path_multiple(tmpdir, script, data): """ Test freeze with multiple --path arguments. """ path1 = tmpdir / "path1" os.mkdir(path1) path2 = tmpdir / "path2" os.mkdir(path2) > script.pip('install', '--find-links', data.find_links, '--target', path1, 'simple==2.0') tests/functional/test_freeze.py:750: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/lib/__init__.py:593: in run _check_stderr( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ stderr = "WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'N...t at 0x7f07e6253280>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/\n" allow_stderr_warning = False, allow_stderr_error = False def _check_stderr( stderr, allow_stderr_warning, allow_stderr_error, ): """ Check the given stderr for logged warnings and errors. :param stderr: stderr output as a string. :param allow_stderr_warning: whether a logged warning (or deprecation message) is allowed. Must be True if allow_stderr_error is True. :param allow_stderr_error: whether a logged error is allowed. """ assert not (allow_stderr_error and not allow_stderr_warning) lines = stderr.splitlines() for line in lines: # First check for logging errors, which we don't allow during # tests even if allow_stderr_error=True (since a logging error # would signal a bug in pip's code). # Unlike errors logged with logger.error(), these errors are # sent directly to stderr and so bypass any configured log formatter. # The "--- Logging error ---" string is used in Python 3.4+, and # "Logged from file " is used in Python 2. if (line.startswith('--- Logging error ---') or line.startswith('Logged from file ')): reason = 'stderr has a logging error, which is never allowed' msg = make_check_stderr_message(stderr, line=line, reason=reason) raise RuntimeError(msg) if allow_stderr_error: continue if line.startswith('ERROR: '): reason = ( 'stderr has an unexpected error ' '(pass allow_stderr_error=True to permit this)' ) msg = make_check_stderr_message(stderr, line=line, reason=reason) raise RuntimeError(msg) if allow_stderr_warning: continue if (line.startswith('WARNING: ') or line.startswith(DEPRECATION_MSG_PREFIX)): reason = ( 'stderr has an unexpected warning ' '(pass allow_stderr_warning=True to permit this)' ) msg = make_check_stderr_message(stderr, line=line, reason=reason) > raise RuntimeError(msg) E RuntimeError: stderr has an unexpected warning (pass allow_stderr_warning=True to permit this): E Caused by line: "WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f07e62ae850>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/" E Complete stderr: WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f07e62ae850>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f07e62aedc0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f07e62aef70>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f07e6253130>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ E WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f07e6253280>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/simple/ tests/lib/__init__.py:404: RuntimeError _________________ test_install_no_binary_builds_pep_517_wheel __________________ script = <tests.lib.PipTestEnvironment object at 0x7fe9509f4e20> data = <tests.lib.TestData object at 0x7fe9509f4640>, with_wheel = None def test_install_no_binary_builds_pep_517_wheel(script, data, with_wheel): to_install = data.packages.joinpath('pep517_setup_and_pyproject') > res = script.pip( 'install', '--no-binary=:all:', '-f', data.find_links, to_install ) tests/functional/test_install.py:1279: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <tests.lib.PipTestEnvironment object at 0x7fe9509f4e20> args = ('python', '-m', 'pip', 'install', '--no-binary=:all:', '-f', ...) kw = {'expect_stderr': True} cwd = Path('/tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/scratch') run_from = None, allow_stderr_error = False, allow_stderr_warning = False expect_error = None def run(self, *args, **kw): """ :param allow_stderr_error: whether a logged error is allowed in stderr. Passing True for this argument implies `allow_stderr_warning` since warnings are weaker than errors. :param allow_stderr_warning: whether a logged warning (or deprecation message) is allowed in stderr. :param expect_error: if False (the default), asserts that the command exits with 0. Otherwise, asserts that the command exits with a non-zero exit code. Passing True also implies allow_stderr_error and allow_stderr_warning. :param expect_stderr: whether to allow warnings in stderr (equivalent to `allow_stderr_warning`). This argument is an abbreviated version of `allow_stderr_warning` and is also kept for backwards compatibility. """ if self.verbose: print('>> running %s %s' % (args, kw)) cwd = kw.pop('cwd', None) run_from = kw.pop('run_from', None) assert not cwd or not run_from, "Don't use run_from; it's going away" cwd = cwd or run_from or self.cwd if sys.platform == 'win32': # Partial fix for ScriptTest.run using `shell=True` on Windows. args = [str(a).replace('^', '^^').replace('&', '^&') for a in args] # Remove `allow_stderr_error` and `allow_stderr_warning` before # calling run() because PipTestEnvironment doesn't support them. allow_stderr_error = kw.pop('allow_stderr_error', None) allow_stderr_warning = kw.pop('allow_stderr_warning', None) # Propagate default values. expect_error = kw.get('expect_error') if expect_error: # Then default to allowing logged errors. if allow_stderr_error is not None and not allow_stderr_error: raise RuntimeError( 'cannot pass allow_stderr_error=False with ' 'expect_error=True' ) allow_stderr_error = True elif kw.get('expect_stderr'): # Then default to allowing logged warnings. if allow_stderr_warning is not None and not allow_stderr_warning: raise RuntimeError( 'cannot pass allow_stderr_warning=False with ' 'expect_stderr=True' ) allow_stderr_warning = True if allow_stderr_error: if allow_stderr_warning is not None and not allow_stderr_warning: raise RuntimeError( 'cannot pass allow_stderr_warning=False with ' 'allow_stderr_error=True' ) # Default values if not set. if allow_stderr_error is None: allow_stderr_error = False if allow_stderr_warning is None: allow_stderr_warning = allow_stderr_error # Pass expect_stderr=True to allow any stderr. We do this because # we do our checking of stderr further on in check_stderr(). kw['expect_stderr'] = True > result = super(PipTestEnvironment, self).run(cwd=cwd, *args, **kw) E AssertionError: Script returned code: 1 tests/lib/__init__.py:586: AssertionError ----------------------------- Captured stdout call ----------------------------- Script result: python -m pip install --no-binary=:all: -f file:///tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/data/packages /tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/data/packages/pep517_setup_and_pyproject return code: 1 -- stderr: -------------------- ERROR: Command errored out with exit status 1: command: /tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/venv/bin/python /builddir/build/BUILDROOT/python-pip-19.3.1-1.fc32.noarch/usr/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-build-env-ntp1m4dh/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple --find-links file:///tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/data/packages -- setuptools cwd: None Complete output (28 lines): Looking in links: file:///tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/data/packages WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7234ef1e50>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7234e92040>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7234e921c0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7234e92340>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f7234e924c0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/ Processing /tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/data/packages/setuptools-0.9.6.tar.gz ERROR: Command errored out with exit status 1: command: /tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-install-b_6lf4z6/setuptools/setup.py'"'"'; __file__='"'"'/tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-install-b_6lf4z6/setuptools/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-install-b_6lf4z6/setuptools/pip-egg-info cwd: /tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-install-b_6lf4z6/setuptools/ Complete output (15 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-install-b_6lf4z6/setuptools/setuptools/__init__.py", line 2, in <module> from setuptools.extension import Extension, Library File "/tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-install-b_6lf4z6/setuptools/setuptools/extension.py", line 5, in <module> from setuptools.dist import _get_unpatched File "/tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-install-b_6lf4z6/setuptools/setuptools/dist.py", line 7, in <module> from setuptools.command.install import install File "/tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-install-b_6lf4z6/setuptools/setuptools/command/__init__.py", line 8, in <module> from setuptools.command import install_scripts File "/tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-install-b_6lf4z6/setuptools/setuptools/command/install_scripts.py", line 3, in <module> from pkg_resources import Distribution, PathMetadata, ensure_directory File "/tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-install-b_6lf4z6/setuptools/pkg_resources.py", line 1545, in <module> register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider) AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ---------------------------------------- ERROR: Command errored out with exit status 1: /tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/venv/bin/python /builddir/build/BUILDROOT/python-pip-19.3.1-1.fc32.noarch/usr/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/workspace/tmp/pip-build-env-ntp1m4dh/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple --find-links file:///tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/data/packages -- setuptools Check the logs for full command output. -- stdout: -------------------- Looking in links: file:///tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/data/packages Processing /tmp/pytest-of-mockbuild/pytest-0/test_install_no_binary_builds_0/data/packages/pep517_setup_and_pyproject Installing build dependencies: started Installing build dependencies: finished with status 'error' _______________________ test_config_file_override_stack ________________________ script = <tests.lib.PipTestEnvironment object at 0x7fe950d9b7f0> virtualenv = <VirtualEnvironment /tmp/pytest-of-mockbuild/pytest-0/test_config_file_override_stac0/workspace/venv> def test_config_file_override_stack(script, virtualenv): """ Test config files (global, overriding a global config with a local, overriding all with a command line flag). """ fd, config_file = tempfile.mkstemp('-pip.cfg', 'test-') try: > _test_config_file_override_stack(script, virtualenv, config_file) tests/functional/test_install_config.py:144: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/functional/test_install_config.py:172: in _test_config_file_override_stack result = script.pip( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <tests.lib.PipTestEnvironment object at 0x7fe950d9b7f0> args = ('python', '-m', 'pip', 'install', '-vvv', '--index-url', ...) kw = {'expect_stderr': True} cwd = Path('/tmp/pytest-of-mockbuild/pytest-0/test_config_file_override_stac0/workspace/scratch') run_from = None, allow_stderr_error = False, allow_stderr_warning = False expect_error = None def run(self, *args, **kw): """ :param allow_stderr_error: whether a logged error is allowed in stderr. Passing True for this argument implies `allow_stderr_warning` since warnings are weaker than errors. :param allow_stderr_warning: whether a logged warning (or deprecation message) is allowed in stderr. :param expect_error: if False (the default), asserts that the command exits with 0. Otherwise, asserts that the command exits with a non-zero exit code. Passing True also implies allow_stderr_error and allow_stderr_warning. :param expect_stderr: whether to allow warnings in stderr (equivalent to `allow_stderr_warning`). This argument is an abbreviated version of `allow_stderr_warning` and is also kept for backwards compatibility. """ if self.verbose: print('>> running %s %s' % (args, kw)) cwd = kw.pop('cwd', None) run_from = kw.pop('run_from', None) assert not cwd or not run_from, "Don't use run_from; it's going away" cwd = cwd or run_from or self.cwd if sys.platform == 'win32': # Partial fix for ScriptTest.run using `shell=True` on Windows. args = [str(a).replace('^', '^^').replace('&', '^&') for a in args] # Remove `allow_stderr_error` and `allow_stderr_warning` before # calling run() because PipTestEnvironment doesn't support them. allow_stderr_error = kw.pop('allow_stderr_error', None) allow_stderr_warning = kw.pop('allow_stderr_warning', None) # Propagate default values. expect_error = kw.get('expect_error') if expect_error: # Then default to allowing logged errors. if allow_stderr_error is not None and not allow_stderr_error: raise RuntimeError( 'cannot pass allow_stderr_error=False with ' 'expect_error=True' ) allow_stderr_error = True elif kw.get('expect_stderr'): # Then default to allowing logged warnings. if allow_stderr_warning is not None and not allow_stderr_warning: raise RuntimeError( 'cannot pass allow_stderr_warning=False with ' 'expect_stderr=True' ) allow_stderr_warning = True if allow_stderr_error: if allow_stderr_warning is not None and not allow_stderr_warning: raise RuntimeError( 'cannot pass allow_stderr_warning=False with ' 'allow_stderr_error=True' ) # Default values if not set. if allow_stderr_error is None: allow_stderr_error = False if allow_stderr_warning is None: allow_stderr_warning = allow_stderr_error # Pass expect_stderr=True to allow any stderr. We do this because # we do our checking of stderr further on in check_stderr(). kw['expect_stderr'] = True > result = super(PipTestEnvironment, self).run(cwd=cwd, *args, **kw) E AssertionError: Script returned code: 1 tests/lib/__init__.py:586: AssertionError ----------------------------- Captured stdout call ----------------------------- Script result: python -m pip install -vvv --index-url https://pypi.org/simple/ INITools return code: 1 -- stderr: -------------------- WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9669c3d8b0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/initools/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9669c3da60>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/initools/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9669c3dbe0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/initools/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9669c3dd60>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/initools/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f966900f490>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/initools/ ERROR: Could not find a version that satisfies the requirement INITools (from versions: none) ERROR: No matching distribution found for INITools -- stdout: -------------------- Created temporary directory: /tmp/pytest-of-mockbuild/pytest-0/test_config_file_override_stac0/workspace/tmp/pip-ephem-wheel-cache-6gj33ens Created temporary directory: /tmp/pytest-of-mockbuild/pytest-0/test_config_file_override_stac0/workspace/tmp/pip-req-tracker-s7_2cwgc Created requirements tracker '/tmp/pytest-of-mockbuild/pytest-0/test_config_file_override_stac0/workspace/tmp/pip-req-tracker-s7_2cwgc' Created temporary directory: /tmp/pytest-of-mockbuild/pytest-0/test_config_file_override_stac0/workspace/tmp/pip-install-_91mh3df Looking in indexes: https://pypi.org/simple/ 1 location(s) to search for versions of INITools: * https://pypi.org/simple/initools/ Getting page https://pypi.org/simple/initools/ Found index url https://pypi.org/simple/ Looking up "https://pypi.org/simple/initools/" in the cache Request header has "max_age" as 0, cache bypassed Starting new HTTPS connection (1): pypi.org:443 Incremented Retry for (url='/simple/initools/'): Retry(total=4, connect=None, read=None, redirect=None, status=None) Starting new HTTPS connection (2): pypi.org:443 Incremented Retry for (url='/simple/initools/'): Retry(total=3, connect=None, read=None, redirect=None, status=None) Starting new HTTPS connection (3): pypi.org:443 Incremented Retry for (url='/simple/initools/'): Retry(total=2, connect=None, read=None, redirect=None, status=None) Starting new HTTPS connection (4): pypi.org:443 Incremented Retry for (url='/simple/initools/'): Retry(total=1, connect=None, read=None, redirect=None, status=None) Starting new HTTPS connection (5): pypi.org:443 Incremented Retry for (url='/simple/initools/'): Retry(total=0, connect=None, read=None, redirect=None, status=None) Starting new HTTPS connection (6): pypi.org:443 Could not fetch URL https://pypi.org/simple/initools/: connection error: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/initools/ (Caused by NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7f9669c15b50>: Failed to establish a new connection: [Errno -2] Name or service not known')) - skipping Given no hashes to check 0 links for project 'INITools': discarding no candidates Cleaning up... Removed build tracker '/tmp/pytest-of-mockbuild/pytest-0/test_config_file_override_stac0/workspace/tmp/pip-req-tracker-s7_2cwgc' Exception information: Traceback (most recent call last): File "/builddir/build/BUILDROOT/python-pip-19.3.1-1.fc32.noarch/usr/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 153, in _main status = self.run(options, args) File "/builddir/build/BUILDROOT/python-pip-19.3.1-1.fc32.noarch/usr/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 401, in run resolver.resolve(requirement_set) File "/builddir/build/BUILDROOT/python-pip-19.3.1-1.fc32.noarch/usr/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py", line 202, in resolve self._resolve_one(requirement_set, req) File "/builddir/build/BUILDROOT/python-pip-19.3.1-1.fc32.noarch/usr/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py", line 368, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "/builddir/build/BUILDROOT/python-pip-19.3.1-1.fc32.noarch/usr/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py", line 314, in _get_abstract_dist_for req.populate_link(self.finder, upgrade_allowed, self.require_hashes) File "/builddir/build/BUILDROOT/python-pip-19.3.1-1.fc32.noarch/usr/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 226, in populate_link self.link = finder.find_requirement(self, upgrade) File "/builddir/build/BUILDROOT/python-pip-19.3.1-1.fc32.noarch/usr/lib/python3.8/site-packages/pip/_internal/index.py", line 905, in find_requirement raise DistributionNotFound( pip._internal.exceptions.DistributionNotFound: No matching distribution found for INITools _______________________ test_no_upgrade_unless_requested _______________________ script = <tests.lib.PipTestEnvironment object at 0x7fe950d86070> def test_no_upgrade_unless_requested(script): """ No upgrade if not specifically requested. """ > script.pip('install', 'INITools==0.1') tests/functional/test_install_upgrade.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <tests.lib.PipTestEnvironment object at 0x7fe950d86070> args = ('python', '-m', 'pip', 'install', 'INITools==0.1') kw = {'expect_stderr': True} cwd = Path('/tmp/pytest-of-mockbuild/pytest-0/test_no_upgrade_unless_request0/workspace/scratch') run_from = None, allow_stderr_error = False, allow_stderr_warning = False expect_error = None def run(self, *args, **kw): """ :param allow_stderr_error: whether a logged error is allowed in stderr. Passing True for this argument implies `allow_stderr_warning` since warnings are weaker than errors. :param allow_stderr_warning: whether a logged warning (or deprecation message) is allowed in stderr. :param expect_error: if False (the default), asserts that the command exits with 0. Otherwise, asserts that the command exits with a non-zero exit code. Passing True also implies allow_stderr_error and allow_stderr_warning. :param expect_stderr: whether to allow warnings in stderr (equivalent to `allow_stderr_warning`). This argument is an abbreviated version of `allow_stderr_warning` and is also kept for backwards compatibility. """ if self.verbose: print('>> running %s %s' % (args, kw)) cwd = kw.pop('cwd', None) run_from = kw.pop('run_from', None) assert not cwd or not run_from, "Don't use run_from; it's going away" cwd = cwd or run_from or self.cwd if sys.platform == 'win32': # Partial fix for ScriptTest.run using `shell=True` on Windows. args = [str(a).replace('^', '^^').replace('&', '^&') for a in args] # Remove `allow_stderr_error` and `allow_stderr_warning` before # calling run() because PipTestEnvironment doesn't support them. allow_stderr_error = kw.pop('allow_stderr_error', None) allow_stderr_warning = kw.pop('allow_stderr_warning', None) # Propagate default values. expect_error = kw.get('expect_error') if expect_error: # Then default to allowing logged errors. if allow_stderr_error is not None and not allow_stderr_error: raise RuntimeError( 'cannot pass allow_stderr_error=False with ' 'expect_error=True' ) allow_stderr_error = True elif kw.get('expect_stderr'): # Then default to allowing logged warnings. if allow_stderr_warning is not None and not allow_stderr_warning: raise RuntimeError( 'cannot pass allow_stderr_warning=False with ' 'expect_stderr=True' ) allow_stderr_warning = True if allow_stderr_error: if allow_stderr_warning is not None and not allow_stderr_warning: raise RuntimeError( 'cannot pass allow_stderr_warning=False with ' 'allow_stderr_error=True' ) # Default values if not set. if allow_stderr_error is None: allow_stderr_error = False if allow_stderr_warning is None: allow_stderr_warning = allow_stderr_error # Pass expect_stderr=True to allow any stderr. We do this because # we do our checking of stderr further on in check_stderr(). kw['expect_stderr'] = True > result = super(PipTestEnvironment, self).run(cwd=cwd, *args, **kw) E AssertionError: Script returned code: 1 tests/lib/__init__.py:586: AssertionError ----------------------------- Captured stdout call ----------------------------- Script result: python -m pip install INITools==0.1 return code: 1 -- stderr: -------------------- WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fd66cc36700>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/initools/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fd66cc36c40>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/initools/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fd66cc36dc0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/initools/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fd66cc36f40>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/initools/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fd66be48100>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/initools/ ERROR: Could not find a version that satisfies the requirement INITools==0.1 (from versions: none) ERROR: No matching distribution found for INITools==0.1
422 lines
14 KiB
Python
422 lines
14 KiB
Python
import os
|
|
import sys
|
|
import textwrap
|
|
|
|
import pytest
|
|
|
|
from tests.lib import assert_all_changes, pyversion
|
|
from tests.lib.local_repos import local_checkout
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_no_upgrade_unless_requested(script):
|
|
"""
|
|
No upgrade if not specifically requested.
|
|
|
|
"""
|
|
script.pip('install', 'INITools==0.1')
|
|
result = script.pip('install', 'INITools')
|
|
assert not result.files_created, (
|
|
'pip install INITools upgraded when it should not have'
|
|
)
|
|
|
|
|
|
def test_invalid_upgrade_strategy_causes_error(script):
|
|
"""
|
|
It errors out when the upgrade-strategy is an invalid/unrecognised one
|
|
|
|
"""
|
|
result = script.pip_install_local(
|
|
'--upgrade', '--upgrade-strategy=bazinga', 'simple',
|
|
expect_error=True
|
|
)
|
|
|
|
assert result.returncode
|
|
assert "invalid choice" in result.stderr
|
|
|
|
|
|
def test_only_if_needed_does_not_upgrade_deps_when_satisfied(script):
|
|
"""
|
|
It doesn't upgrade a dependency if it already satisfies the requirements.
|
|
|
|
"""
|
|
script.pip_install_local('simple==2.0')
|
|
result = script.pip_install_local(
|
|
'--upgrade', '--upgrade-strategy=only-if-needed', 'require_simple'
|
|
)
|
|
|
|
assert (
|
|
(script.site_packages / 'require_simple-1.0-py%s.egg-info' % pyversion)
|
|
not in result.files_deleted
|
|
), "should have installed require_simple==1.0"
|
|
assert (
|
|
(script.site_packages / 'simple-2.0-py%s.egg-info' % pyversion)
|
|
not in result.files_deleted
|
|
), "should not have uninstalled simple==2.0"
|
|
assert (
|
|
"Requirement already satisfied, skipping upgrade: simple"
|
|
in result.stdout
|
|
), "did not print correct message for not-upgraded requirement"
|
|
|
|
|
|
def test_only_if_needed_does_upgrade_deps_when_no_longer_satisfied(script):
|
|
"""
|
|
It does upgrade a dependency if it no longer satisfies the requirements.
|
|
|
|
"""
|
|
script.pip_install_local('simple==1.0')
|
|
result = script.pip_install_local(
|
|
'--upgrade', '--upgrade-strategy=only-if-needed', 'require_simple'
|
|
)
|
|
|
|
assert (
|
|
(script.site_packages / 'require_simple-1.0-py%s.egg-info' % pyversion)
|
|
not in result.files_deleted
|
|
), "should have installed require_simple==1.0"
|
|
assert (
|
|
script.site_packages / 'simple-3.0-py%s.egg-info' %
|
|
pyversion in result.files_created
|
|
), "should have installed simple==3.0"
|
|
assert (
|
|
script.site_packages / 'simple-1.0-py%s.egg-info' %
|
|
pyversion in result.files_deleted
|
|
), "should have uninstalled simple==1.0"
|
|
|
|
|
|
def test_eager_does_upgrade_dependecies_when_currently_satisfied(script):
|
|
"""
|
|
It does upgrade a dependency even if it already satisfies the requirements.
|
|
|
|
"""
|
|
script.pip_install_local('simple==2.0')
|
|
result = script.pip_install_local(
|
|
'--upgrade', '--upgrade-strategy=eager', 'require_simple'
|
|
)
|
|
|
|
assert (
|
|
(script.site_packages / 'require_simple-1.0-py%s.egg-info' % pyversion)
|
|
not in result.files_deleted
|
|
), "should have installed require_simple==1.0"
|
|
assert (
|
|
(script.site_packages / 'simple-2.0-py%s.egg-info' % pyversion)
|
|
in result.files_deleted
|
|
), "should have uninstalled simple==2.0"
|
|
|
|
|
|
def test_eager_does_upgrade_dependecies_when_no_longer_satisfied(script):
|
|
"""
|
|
It does upgrade a dependency if it no longer satisfies the requirements.
|
|
|
|
"""
|
|
script.pip_install_local('simple==1.0')
|
|
result = script.pip_install_local(
|
|
'--upgrade', '--upgrade-strategy=eager', 'require_simple'
|
|
)
|
|
|
|
assert (
|
|
(script.site_packages / 'require_simple-1.0-py%s.egg-info' % pyversion)
|
|
not in result.files_deleted
|
|
), "should have installed require_simple==1.0"
|
|
assert (
|
|
script.site_packages / 'simple-3.0-py%s.egg-info' %
|
|
pyversion in result.files_created
|
|
), "should have installed simple==3.0"
|
|
assert (
|
|
script.site_packages / 'simple-1.0-py%s.egg-info' %
|
|
pyversion in result.files_deleted
|
|
), "should have uninstalled simple==1.0"
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_upgrade_to_specific_version(script):
|
|
"""
|
|
It does upgrade to specific version requested.
|
|
|
|
"""
|
|
script.pip('install', 'INITools==0.1')
|
|
result = script.pip('install', 'INITools==0.2')
|
|
assert result.files_created, (
|
|
'pip install with specific version did not upgrade'
|
|
)
|
|
assert (
|
|
script.site_packages / 'INITools-0.1-py%s.egg-info' %
|
|
pyversion in result.files_deleted
|
|
)
|
|
assert (
|
|
script.site_packages / 'INITools-0.2-py%s.egg-info' %
|
|
pyversion in result.files_created
|
|
)
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_upgrade_if_requested(script):
|
|
"""
|
|
And it does upgrade if requested.
|
|
|
|
"""
|
|
script.pip('install', 'INITools==0.1')
|
|
result = script.pip('install', '--upgrade', 'INITools')
|
|
assert result.files_created, 'pip install --upgrade did not upgrade'
|
|
assert (
|
|
script.site_packages / 'INITools-0.1-py%s.egg-info' %
|
|
pyversion not in result.files_created
|
|
)
|
|
|
|
|
|
def test_upgrade_with_newest_already_installed(script, data):
|
|
"""
|
|
If the newest version of a package is already installed, the package should
|
|
not be reinstalled and the user should be informed.
|
|
"""
|
|
script.pip('install', '-f', data.find_links, '--no-index', 'simple')
|
|
result = script.pip(
|
|
'install', '--upgrade', '-f', data.find_links, '--no-index', 'simple'
|
|
)
|
|
assert not result.files_created, 'simple upgraded when it should not have'
|
|
assert 'already up-to-date' in result.stdout, result.stdout
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_upgrade_force_reinstall_newest(script):
|
|
"""
|
|
Force reinstallation of a package even if it is already at its newest
|
|
version if --force-reinstall is supplied.
|
|
"""
|
|
result = script.pip('install', 'INITools')
|
|
assert script.site_packages / 'initools' in result.files_created, (
|
|
sorted(result.files_created.keys())
|
|
)
|
|
result2 = script.pip(
|
|
'install', '--upgrade', '--force-reinstall', 'INITools'
|
|
)
|
|
assert result2.files_updated, 'upgrade to INITools 0.3 failed'
|
|
result3 = script.pip('uninstall', 'initools', '-y')
|
|
assert_all_changes(result, result3, [script.venv / 'build', 'cache'])
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_uninstall_before_upgrade(script):
|
|
"""
|
|
Automatic uninstall-before-upgrade.
|
|
|
|
"""
|
|
result = script.pip('install', 'INITools==0.2')
|
|
assert script.site_packages / 'initools' in result.files_created, (
|
|
sorted(result.files_created.keys())
|
|
)
|
|
result2 = script.pip('install', 'INITools==0.3')
|
|
assert result2.files_created, 'upgrade to INITools 0.3 failed'
|
|
result3 = script.pip('uninstall', 'initools', '-y')
|
|
assert_all_changes(result, result3, [script.venv / 'build', 'cache'])
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_uninstall_before_upgrade_from_url(script):
|
|
"""
|
|
Automatic uninstall-before-upgrade from URL.
|
|
|
|
"""
|
|
result = script.pip('install', 'INITools==0.2')
|
|
assert script.site_packages / 'initools' in result.files_created, (
|
|
sorted(result.files_created.keys())
|
|
)
|
|
result2 = script.pip(
|
|
'install',
|
|
'https://files.pythonhosted.org/packages/source/I/INITools/INITools-'
|
|
'0.3.tar.gz',
|
|
)
|
|
assert result2.files_created, 'upgrade to INITools 0.3 failed'
|
|
result3 = script.pip('uninstall', 'initools', '-y')
|
|
assert_all_changes(result, result3, [script.venv / 'build', 'cache'])
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_upgrade_to_same_version_from_url(script):
|
|
"""
|
|
When installing from a URL the same version that is already installed, no
|
|
need to uninstall and reinstall if --upgrade is not specified.
|
|
|
|
"""
|
|
result = script.pip('install', 'INITools==0.3')
|
|
assert script.site_packages / 'initools' in result.files_created, (
|
|
sorted(result.files_created.keys())
|
|
)
|
|
result2 = script.pip(
|
|
'install',
|
|
'https://files.pythonhosted.org/packages/source/I/INITools/INITools-'
|
|
'0.3.tar.gz',
|
|
)
|
|
assert script.site_packages / 'initools' not in result2.files_updated, (
|
|
'INITools 0.3 reinstalled same version'
|
|
)
|
|
result3 = script.pip('uninstall', 'initools', '-y')
|
|
assert_all_changes(result, result3, [script.venv / 'build', 'cache'])
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_upgrade_from_reqs_file(script):
|
|
"""
|
|
Upgrade from a requirements file.
|
|
|
|
"""
|
|
script.scratch_path.joinpath("test-req.txt").write_text(textwrap.dedent("""\
|
|
PyLogo<0.4
|
|
# and something else to test out:
|
|
INITools==0.3
|
|
"""))
|
|
install_result = script.pip(
|
|
'install', '-r', script.scratch_path / 'test-req.txt'
|
|
)
|
|
script.scratch_path.joinpath("test-req.txt").write_text(textwrap.dedent("""\
|
|
PyLogo
|
|
# and something else to test out:
|
|
INITools
|
|
"""))
|
|
script.pip(
|
|
'install', '--upgrade', '-r', script.scratch_path / 'test-req.txt'
|
|
)
|
|
uninstall_result = script.pip(
|
|
'uninstall', '-r', script.scratch_path / 'test-req.txt', '-y'
|
|
)
|
|
assert_all_changes(
|
|
install_result,
|
|
uninstall_result,
|
|
[script.venv / 'build', 'cache', script.scratch / 'test-req.txt'],
|
|
)
|
|
|
|
|
|
def test_uninstall_rollback(script, data):
|
|
"""
|
|
Test uninstall-rollback (using test package with a setup.py
|
|
crafted to fail on install).
|
|
|
|
"""
|
|
result = script.pip(
|
|
'install', '-f', data.find_links, '--no-index', 'broken==0.1'
|
|
)
|
|
assert script.site_packages / 'broken.py' in result.files_created, list(
|
|
result.files_created.keys()
|
|
)
|
|
result2 = script.pip(
|
|
'install', '-f', data.find_links, '--no-index', 'broken===0.2broken',
|
|
expect_error=True,
|
|
)
|
|
assert result2.returncode == 1, str(result2)
|
|
assert script.run(
|
|
'python', '-c', "import broken; print(broken.VERSION)"
|
|
).stdout == '0.1\n'
|
|
assert_all_changes(
|
|
result.files_after,
|
|
result2,
|
|
[script.venv / 'build'],
|
|
)
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_should_not_install_always_from_cache(script):
|
|
"""
|
|
If there is an old cached package, pip should download the newer version
|
|
Related to issue #175
|
|
"""
|
|
script.pip('install', 'INITools==0.2')
|
|
script.pip('uninstall', '-y', 'INITools')
|
|
result = script.pip('install', 'INITools==0.1')
|
|
assert (
|
|
script.site_packages / 'INITools-0.2-py%s.egg-info' %
|
|
pyversion not in result.files_created
|
|
)
|
|
assert (
|
|
script.site_packages / 'INITools-0.1-py%s.egg-info' %
|
|
pyversion in result.files_created
|
|
)
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_install_with_ignoreinstalled_requested(script):
|
|
"""
|
|
Test old conflicting package is completely ignored
|
|
"""
|
|
script.pip('install', 'INITools==0.1')
|
|
result = script.pip('install', '-I', 'INITools==0.3')
|
|
assert result.files_created, 'pip install -I did not install'
|
|
# both the old and new metadata should be present.
|
|
assert os.path.exists(
|
|
script.site_packages_path / 'INITools-0.1-py%s.egg-info' % pyversion
|
|
)
|
|
assert os.path.exists(
|
|
script.site_packages_path / 'INITools-0.3-py%s.egg-info' % pyversion
|
|
)
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_upgrade_vcs_req_with_no_dists_found(script, tmpdir):
|
|
"""It can upgrade a VCS requirement that has no distributions otherwise."""
|
|
req = "%s#egg=pip-test-package" % local_checkout(
|
|
"git+https://github.com/pypa/pip-test-package.git", tmpdir,
|
|
)
|
|
script.pip("install", req)
|
|
result = script.pip("install", "-U", req)
|
|
assert not result.returncode
|
|
|
|
|
|
@pytest.mark.network
|
|
def test_upgrade_vcs_req_with_dist_found(script):
|
|
"""It can upgrade a VCS requirement that has distributions on the index."""
|
|
# TODO(pnasrat) Using local_checkout fails on windows - oddness with the
|
|
# test path urls/git.
|
|
req = (
|
|
"%s#egg=pretend" %
|
|
(
|
|
"git+git://github.com/alex/pretend@e7f26ad7dbcb4a02a4995aade4"
|
|
"743aad47656b27"
|
|
)
|
|
)
|
|
script.pip("install", req, expect_stderr=True)
|
|
result = script.pip("install", "-U", req, expect_stderr=True)
|
|
assert "pypi.org" not in result.stdout, result.stdout
|
|
|
|
|
|
class TestUpgradeDistributeToSetuptools(object):
|
|
"""
|
|
From pip1.4 to pip6, pip supported a set of "hacks" (see Issue #1122) to
|
|
allow distribute to conflict with setuptools, so that the following would
|
|
work to upgrade distribute:
|
|
|
|
``pip install -U setuptools``
|
|
|
|
In pip7, the hacks were removed. This test remains to at least confirm pip
|
|
can upgrade distribute to setuptools using:
|
|
|
|
``pip install -U distribute``
|
|
|
|
The reason this works is that a final version of distribute (v0.7.3) was
|
|
released that is simple wrapper with:
|
|
|
|
install_requires=['setuptools>=0.7']
|
|
|
|
The test use a fixed set of packages from our test packages dir. Note that
|
|
virtualenv-1.9.1 contains distribute-0.6.34 and virtualenv-1.10 contains
|
|
setuptools-0.9.7
|
|
"""
|
|
|
|
def prep_ve(self, script, version, pip_src, distribute=False):
|
|
self.script = script
|
|
self.script.pip_install_local('virtualenv==%s' % version)
|
|
args = ['virtualenv', self.script.scratch_path / 'VE']
|
|
if distribute:
|
|
args.insert(1, '--distribute')
|
|
if version == "1.9.1" and not distribute:
|
|
# setuptools 0.6 didn't support PYTHONDONTWRITEBYTECODE
|
|
del self.script.environ["PYTHONDONTWRITEBYTECODE"]
|
|
self.script.run(*args)
|
|
if sys.platform == 'win32':
|
|
bindir = "Scripts"
|
|
else:
|
|
bindir = "bin"
|
|
self.ve_bin = self.script.scratch_path / 'VE' / bindir
|
|
self.script.run(self.ve_bin / 'pip', 'uninstall', '-y', 'pip')
|
|
self.script.run(
|
|
self.ve_bin / 'python', 'setup.py', 'install',
|
|
cwd=pip_src,
|
|
expect_stderr=True,
|
|
)
|