2016-05-26 12:45:46 +02:00
|
|
|
import os
|
2010-06-03 04:25:26 +02:00
|
|
|
import re
|
2017-05-16 12:16:30 +02:00
|
|
|
import sys
|
2010-02-24 11:24:55 +01:00
|
|
|
import textwrap
|
2017-05-16 12:16:30 +02:00
|
|
|
from doctest import ELLIPSIS, OutputChecker
|
2013-08-22 06:40:46 +02:00
|
|
|
|
2017-05-16 12:16:30 +02:00
|
|
|
import pytest
|
2021-02-28 13:01:28 +01:00
|
|
|
from pip._vendor.packaging.utils import canonicalize_name
|
2017-06-13 14:17:00 +02:00
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
from pip._internal.models.direct_url import DirectUrl, DirInfo
|
2017-10-06 21:51:42 +02:00
|
|
|
from tests.lib import (
|
2021-09-13 00:31:12 +02:00
|
|
|
PipTestEnvironment,
|
|
|
|
TestData,
|
2019-07-22 06:45:27 +02:00
|
|
|
_create_test_package,
|
|
|
|
_create_test_package_with_srcdir,
|
|
|
|
_git_commit,
|
2020-01-14 10:54:54 +01:00
|
|
|
_vcs_add,
|
2020-04-05 19:47:03 +02:00
|
|
|
create_test_package_with_setup,
|
2019-07-22 06:45:27 +02:00
|
|
|
need_bzr,
|
|
|
|
need_mercurial,
|
2019-10-14 11:57:57 +02:00
|
|
|
need_svn,
|
2019-07-22 06:45:27 +02:00
|
|
|
path_to_url,
|
2020-10-30 21:50:59 +01:00
|
|
|
wheel,
|
2017-10-06 21:51:42 +02:00
|
|
|
)
|
2021-08-01 10:48:27 +02:00
|
|
|
from tests.lib.direct_url import get_created_direct_url_path
|
2021-09-13 00:31:12 +02:00
|
|
|
from tests.lib.path import Path
|
|
|
|
from tests.lib.venv import VirtualEnvironment
|
2010-06-16 11:51:21 +02:00
|
|
|
|
2021-08-13 15:23:45 +02:00
|
|
|
distribute_re = re.compile("^distribute==[0-9.]+\n", re.MULTILINE)
|
2010-05-21 16:31:14 +02:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def _check_output(result: str, expected: str) -> None:
|
2010-05-02 04:16:30 +02:00
|
|
|
checker = OutputChecker()
|
|
|
|
actual = str(result)
|
|
|
|
|
2014-03-26 23:24:19 +01:00
|
|
|
# FIXME! The following is a TOTAL hack. For some reason the
|
|
|
|
# __str__ result for pkg_resources.Requirement gets downcased on
|
|
|
|
# Windows. Since INITools is the only package we're installing
|
|
|
|
# in this file with funky case requirements, I'm forcibly
|
|
|
|
# upcasing it. You can also normalize everything to lowercase,
|
|
|
|
# but then you have to remember to upcase <BLANKLINE>. The right
|
|
|
|
# thing to do in the end is probably to find out how to report
|
|
|
|
# the proper fully-cased package name in our error message.
|
2021-08-13 15:23:45 +02:00
|
|
|
if sys.platform == "win32":
|
|
|
|
actual = actual.replace("initools", "INITools")
|
2010-05-02 04:16:30 +02:00
|
|
|
|
2010-05-21 16:31:14 +02:00
|
|
|
# This allows our existing tests to work when run in a context
|
|
|
|
# with distribute installed.
|
2021-08-13 15:23:45 +02:00
|
|
|
actual = distribute_re.sub("", actual)
|
2010-05-21 16:31:14 +02:00
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def banner(msg: str) -> str:
|
2021-08-13 15:23:45 +02:00
|
|
|
return f"\n========== {msg} ==========\n"
|
2014-03-08 18:49:41 +01:00
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
assert checker.check_output(expected, actual, ELLIPSIS), (
|
2021-08-13 15:23:45 +02:00
|
|
|
banner("EXPECTED") + expected + banner("ACTUAL") + actual + banner(6 * "=")
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2010-02-24 11:24:55 +01:00
|
|
|
|
2011-05-04 09:44:02 +02:00
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_basic_freeze(script: PipTestEnvironment) -> None:
|
2011-03-19 01:31:36 +01:00
|
|
|
"""
|
|
|
|
Some tests of freeze, first we have to install some stuff. Note that
|
|
|
|
the test is a little crude at the end because Python 2.5+ adds egg
|
|
|
|
info to the standard library, so stuff like wsgiref will show up in
|
|
|
|
the freezing. (Probably that should be accounted for in pip, but
|
|
|
|
currently it is not).
|
|
|
|
|
|
|
|
"""
|
2021-08-13 15:23:45 +02:00
|
|
|
script.scratch_path.joinpath("initools-req.txt").write_text(
|
|
|
|
textwrap.dedent(
|
|
|
|
"""\
|
2013-06-20 00:55:17 +02:00
|
|
|
simple==2.0
|
2011-03-19 01:31:36 +01:00
|
|
|
# and something else to test out:
|
2013-06-20 00:55:17 +02:00
|
|
|
simple2<=3.0
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
)
|
2014-03-08 18:49:41 +01:00
|
|
|
script.pip_install_local(
|
2021-08-13 15:23:45 +02:00
|
|
|
"-r",
|
|
|
|
script.scratch_path / "initools-req.txt",
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2013-06-20 01:35:28 +02:00
|
|
|
...simple==2.0
|
2013-06-20 00:55:17 +02:00
|
|
|
simple2==3.0...
|
2021-08-13 15:23:45 +02:00
|
|
|
<BLANKLINE>"""
|
|
|
|
)
|
2016-01-02 04:20:14 +01:00
|
|
|
_check_output(result.stdout, expected)
|
2011-03-19 01:31:36 +01:00
|
|
|
|
2011-05-04 09:44:02 +02:00
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_with_pip(script: PipTestEnvironment) -> None:
|
2015-10-10 23:31:29 +02:00
|
|
|
"""Test pip shows itself"""
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", "--all")
|
|
|
|
assert "pip==" in result.stdout
|
2015-10-10 23:31:29 +02:00
|
|
|
|
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_exclude_and_normalization(script: PipTestEnvironment, tmpdir: Path) -> None:
|
2021-08-13 15:23:45 +02:00
|
|
|
req_path = wheel.make_wheel(name="Normalizable_Name", version="1.0").save_to_dir(
|
|
|
|
tmpdir
|
|
|
|
)
|
2020-10-30 21:50:59 +01:00
|
|
|
script.pip("install", "--no-index", req_path)
|
|
|
|
result = script.pip("freeze")
|
2021-07-13 11:43:52 +02:00
|
|
|
assert "Normalizable_Name" in result.stdout
|
2020-10-30 21:50:59 +01:00
|
|
|
result = script.pip("freeze", "--exclude", "normalizablE-namE")
|
2021-07-13 11:43:52 +02:00
|
|
|
assert "Normalizable_Name" not in result.stdout
|
2020-10-30 21:50:59 +01:00
|
|
|
|
|
|
|
|
2021-09-21 06:44:29 +02:00
|
|
|
@pytest.mark.usefixtures("with_wheel")
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_multiple_exclude_with_all(script: PipTestEnvironment) -> None:
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", "--all")
|
|
|
|
assert "pip==" in result.stdout
|
|
|
|
assert "wheel==" in result.stdout
|
|
|
|
result = script.pip("freeze", "--all", "--exclude", "pip", "--exclude", "wheel")
|
|
|
|
assert "pip==" not in result.stdout
|
|
|
|
assert "wheel==" not in result.stdout
|
2020-10-30 21:50:59 +01:00
|
|
|
|
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_with_invalid_names(script: PipTestEnvironment) -> None:
|
2016-05-26 12:36:16 +02:00
|
|
|
"""
|
|
|
|
Test that invalid names produce warnings and are passed over gracefully.
|
|
|
|
"""
|
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def fake_install(pkgname: str, dest: str) -> None:
|
2016-05-26 12:36:16 +02:00
|
|
|
egg_info_path = os.path.join(
|
2021-08-13 15:23:45 +02:00
|
|
|
dest,
|
|
|
|
"{}-1.0-py{}.{}.egg-info".format(
|
|
|
|
pkgname.replace("-", "_"), sys.version_info[0], sys.version_info[1]
|
|
|
|
),
|
2016-05-26 12:36:16 +02:00
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
with open(egg_info_path, "w") as egg_info_file:
|
|
|
|
egg_info_file.write(
|
|
|
|
textwrap.dedent(
|
|
|
|
"""\
|
2016-05-26 12:36:16 +02:00
|
|
|
Metadata-Version: 1.0
|
2017-12-15 06:56:04 +01:00
|
|
|
Name: {}
|
2016-05-26 12:36:16 +02:00
|
|
|
Version: 1.0
|
2021-08-13 15:23:45 +02:00
|
|
|
""".format(
|
|
|
|
pkgname
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
2016-05-26 12:36:16 +02:00
|
|
|
|
2021-08-13 15:23:45 +02:00
|
|
|
valid_pkgnames = ("middle-dash", "middle_underscore", "middle.dot")
|
2016-05-26 12:36:16 +02:00
|
|
|
invalid_pkgnames = (
|
2021-08-13 15:23:45 +02:00
|
|
|
"-leadingdash",
|
|
|
|
"_leadingunderscore",
|
|
|
|
".leadingdot",
|
|
|
|
"trailingdash-",
|
|
|
|
"trailingunderscore_",
|
|
|
|
"trailingdot.",
|
2016-05-26 12:36:16 +02:00
|
|
|
)
|
|
|
|
for pkgname in valid_pkgnames + invalid_pkgnames:
|
|
|
|
fake_install(pkgname, script.site_packages_path)
|
2021-02-28 13:01:28 +01:00
|
|
|
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
2019-05-25 09:31:44 +02:00
|
|
|
|
2021-02-28 13:01:28 +01:00
|
|
|
# Check all valid names are in the output.
|
|
|
|
output_lines = {line.strip() for line in result.stdout.splitlines()}
|
|
|
|
for name in valid_pkgnames:
|
2021-07-13 11:43:52 +02:00
|
|
|
assert f"{name}==1.0" in output_lines
|
2021-02-28 13:01:28 +01:00
|
|
|
|
|
|
|
# Check all invalid names are excluded from the output.
|
|
|
|
canonical_invalid_names = {canonicalize_name(n) for n in invalid_pkgnames}
|
|
|
|
for line in output_lines:
|
|
|
|
output_name, _, _ = line.partition("=")
|
|
|
|
assert canonicalize_name(output_name) not in canonical_invalid_names
|
|
|
|
|
|
|
|
# The invalid names should be logged.
|
|
|
|
for name in canonical_invalid_names:
|
|
|
|
assert f"Ignoring invalid distribution {name} (" in result.stderr
|
2016-05-26 12:36:16 +02:00
|
|
|
|
|
|
|
|
2018-10-21 05:51:50 +02:00
|
|
|
@pytest.mark.git
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_editable_not_vcs(script: PipTestEnvironment) -> None:
|
2018-10-21 05:51:50 +02:00
|
|
|
"""
|
|
|
|
Test an editable install that is not version controlled.
|
|
|
|
"""
|
|
|
|
pkg_path = _create_test_package(script)
|
|
|
|
# Rename the .git directory so the directory is no longer recognized
|
|
|
|
# as a VCS directory.
|
2021-08-13 15:23:45 +02:00
|
|
|
os.rename(os.path.join(pkg_path, ".git"), os.path.join(pkg_path, ".bak"))
|
|
|
|
script.pip("install", "-e", pkg_path)
|
|
|
|
result = script.pip("freeze")
|
2018-10-21 05:51:50 +02:00
|
|
|
|
|
|
|
# We need to apply os.path.normcase() to the path since that is what
|
|
|
|
# the freeze code does.
|
2021-08-13 15:23:45 +02:00
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2019-01-12 21:44:45 +01:00
|
|
|
...# Editable install with no version control (version-pkg==0.1)
|
2018-10-21 05:51:50 +02:00
|
|
|
-e {}
|
2021-08-13 15:23:45 +02:00
|
|
|
...""".format(
|
|
|
|
os.path.normcase(pkg_path)
|
|
|
|
)
|
|
|
|
)
|
2018-10-21 05:51:50 +02:00
|
|
|
_check_output(result.stdout, expected)
|
|
|
|
|
|
|
|
|
2018-12-21 08:59:10 +01:00
|
|
|
@pytest.mark.git
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_editable_git_with_no_remote(
|
|
|
|
script: PipTestEnvironment, deprecated_python: bool
|
|
|
|
) -> None:
|
2018-12-21 08:59:10 +01:00
|
|
|
"""
|
2018-12-21 09:22:32 +01:00
|
|
|
Test an editable Git install with no remote url.
|
2018-12-21 08:59:10 +01:00
|
|
|
"""
|
|
|
|
pkg_path = _create_test_package(script)
|
2021-08-13 15:23:45 +02:00
|
|
|
script.pip("install", "-e", pkg_path)
|
|
|
|
result = script.pip("freeze")
|
2018-12-21 08:59:10 +01:00
|
|
|
|
2019-01-11 11:12:44 +01:00
|
|
|
if not deprecated_python:
|
2021-08-13 15:23:45 +02:00
|
|
|
assert result.stderr == ""
|
2018-12-21 10:19:25 +01:00
|
|
|
|
2018-12-21 08:59:10 +01:00
|
|
|
# We need to apply os.path.normcase() to the path since that is what
|
|
|
|
# the freeze code does.
|
2021-08-13 15:23:45 +02:00
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2018-12-21 09:22:32 +01:00
|
|
|
...# Editable Git install with no remote (version-pkg==0.1)
|
2018-12-21 08:59:10 +01:00
|
|
|
-e {}
|
2021-08-13 15:23:45 +02:00
|
|
|
...""".format(
|
|
|
|
os.path.normcase(pkg_path)
|
|
|
|
)
|
|
|
|
)
|
2018-12-21 08:59:10 +01:00
|
|
|
_check_output(result.stdout, expected)
|
|
|
|
|
|
|
|
|
2019-10-14 11:57:57 +02:00
|
|
|
@need_svn
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_svn(script: PipTestEnvironment) -> None:
|
2013-01-23 05:52:35 +01:00
|
|
|
"""Test freezing a svn checkout"""
|
|
|
|
|
2021-08-13 15:23:45 +02:00
|
|
|
checkout_path = _create_test_package(script, vcs="svn")
|
2013-01-23 05:52:35 +01:00
|
|
|
|
2014-03-08 18:49:41 +01:00
|
|
|
# Install with develop
|
2021-08-13 15:23:45 +02:00
|
|
|
script.run("python", "setup.py", "develop", cwd=checkout_path, expect_stderr=True)
|
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2015-12-18 22:48:12 +01:00
|
|
|
...-e svn+...#egg=version_pkg
|
2021-08-13 15:23:45 +02:00
|
|
|
..."""
|
|
|
|
)
|
2016-01-02 04:20:14 +01:00
|
|
|
_check_output(result.stdout, expected)
|
2011-03-19 01:31:36 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2017-01-11 22:37:39 +01:00
|
|
|
@pytest.mark.git
|
2020-05-14 09:11:10 +02:00
|
|
|
@pytest.mark.xfail(
|
|
|
|
condition=True,
|
|
|
|
reason="xfail means editable is not in output",
|
|
|
|
run=True,
|
|
|
|
strict=True,
|
|
|
|
)
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_exclude_editable(script: PipTestEnvironment) -> None:
|
2017-01-11 22:37:39 +01:00
|
|
|
"""
|
|
|
|
Test excluding editable from freezing list.
|
|
|
|
"""
|
|
|
|
# Returns path to a generated package called "version_pkg"
|
|
|
|
pkg_version = _create_test_package(script)
|
|
|
|
|
|
|
|
result = script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"git",
|
|
|
|
"clone",
|
|
|
|
pkg_version,
|
|
|
|
"pip-test-package",
|
2017-01-11 22:37:39 +01:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
repo_dir = script.scratch_path / "pip-test-package"
|
2017-01-11 22:37:39 +01:00
|
|
|
result = script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"python",
|
|
|
|
"setup.py",
|
|
|
|
"develop",
|
2017-01-11 22:37:39 +01:00
|
|
|
cwd=repo_dir,
|
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", "--exclude-editable", expect_stderr=True)
|
2017-01-11 22:37:39 +01:00
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""
|
|
|
|
...-e git+...#egg=version_pkg
|
|
|
|
...
|
|
|
|
"""
|
|
|
|
).strip()
|
|
|
|
_check_output(result.stdout, expected)
|
|
|
|
|
|
|
|
|
2015-03-09 22:13:05 +01:00
|
|
|
@pytest.mark.git
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_git_clone(script: PipTestEnvironment) -> None:
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test freezing a Git clone.
|
|
|
|
"""
|
2015-03-09 22:13:05 +01:00
|
|
|
# Returns path to a generated package called "version_pkg"
|
|
|
|
pkg_version = _create_test_package(script)
|
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"git",
|
|
|
|
"clone",
|
|
|
|
pkg_version,
|
|
|
|
"pip-test-package",
|
2014-01-28 15:17:51 +01:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
repo_dir = script.scratch_path / "pip-test-package"
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"python",
|
|
|
|
"setup.py",
|
|
|
|
"develop",
|
2015-01-28 23:40:02 +01:00
|
|
|
cwd=repo_dir,
|
|
|
|
expect_stderr=True,
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
2014-01-28 15:17:51 +01:00
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""
|
2015-12-18 22:48:12 +01:00
|
|
|
...-e git+...#egg=version_pkg
|
2014-01-28 15:17:51 +01:00
|
|
|
...
|
2015-03-09 22:13:05 +01:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
).strip()
|
2016-01-02 04:20:14 +01:00
|
|
|
_check_output(result.stdout, expected)
|
2010-02-24 11:24:55 +01:00
|
|
|
|
2014-09-26 19:19:03 +02:00
|
|
|
# Check that slashes in branch or tag names are translated.
|
|
|
|
# See also issue #1083: https://github.com/pypa/pip/issues/1083
|
|
|
|
script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"git",
|
|
|
|
"checkout",
|
|
|
|
"-b",
|
|
|
|
"branch/name/with/slash",
|
2014-09-26 19:24:11 +02:00
|
|
|
cwd=repo_dir,
|
2014-09-26 19:19:03 +02:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
|
|
|
# Create a new commit to ensure that the commit has only one branch
|
|
|
|
# or tag name associated to it (to avoid the non-determinism reported
|
|
|
|
# in issue #1867).
|
2021-08-13 15:23:45 +02:00
|
|
|
(repo_dir / "newfile").touch()
|
|
|
|
script.run("git", "add", "newfile", cwd=repo_dir)
|
|
|
|
_git_commit(script, repo_dir, message="...")
|
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
2014-09-26 19:19:03 +02:00
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""
|
2015-12-18 22:48:12 +01:00
|
|
|
...-e ...@...#egg=version_pkg
|
2014-09-26 19:19:03 +02:00
|
|
|
...
|
|
|
|
"""
|
|
|
|
).strip()
|
2016-01-02 04:20:14 +01:00
|
|
|
_check_output(result.stdout, expected)
|
2014-09-26 19:19:03 +02:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2015-11-22 13:00:14 +01:00
|
|
|
@pytest.mark.git
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_git_clone_srcdir(script: PipTestEnvironment) -> None:
|
2015-11-22 13:00:14 +01:00
|
|
|
"""
|
|
|
|
Test freezing a Git clone where setup.py is in a subdirectory
|
|
|
|
relative the repo root and the source code is in a subdirectory
|
|
|
|
relative to setup.py.
|
|
|
|
"""
|
|
|
|
# Returns path to a generated package called "version_pkg"
|
|
|
|
pkg_version = _create_test_package_with_srcdir(script)
|
|
|
|
|
|
|
|
result = script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"git",
|
|
|
|
"clone",
|
|
|
|
pkg_version,
|
|
|
|
"pip-test-package",
|
2015-11-22 13:00:14 +01:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
repo_dir = script.scratch_path / "pip-test-package"
|
2015-11-22 13:00:14 +01:00
|
|
|
result = script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"python",
|
|
|
|
"setup.py",
|
|
|
|
"develop",
|
|
|
|
cwd=repo_dir / "subdir",
|
2015-11-22 13:00:14 +01:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
2015-11-22 13:00:14 +01:00
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""
|
2015-12-18 22:48:12 +01:00
|
|
|
...-e git+...#egg=version_pkg&subdirectory=subdir
|
2015-11-22 13:00:14 +01:00
|
|
|
...
|
|
|
|
"""
|
|
|
|
).strip()
|
2016-01-02 04:20:14 +01:00
|
|
|
_check_output(result.stdout, expected)
|
2015-11-22 13:00:14 +01:00
|
|
|
|
2019-09-24 11:05:30 +02:00
|
|
|
|
2019-09-24 02:28:40 +02:00
|
|
|
@need_mercurial
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_mercurial_clone_srcdir(script: PipTestEnvironment) -> None:
|
2019-09-24 02:28:40 +02:00
|
|
|
"""
|
|
|
|
Test freezing a Mercurial clone where setup.py is in a subdirectory
|
|
|
|
relative to the repo root and the source code is in a subdirectory
|
|
|
|
relative to setup.py.
|
|
|
|
"""
|
|
|
|
# Returns path to a generated package called "version_pkg"
|
2021-08-13 15:23:45 +02:00
|
|
|
pkg_version = _create_test_package_with_srcdir(script, vcs="hg")
|
2019-09-24 11:05:30 +02:00
|
|
|
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.run("hg", "clone", pkg_version, "pip-test-package")
|
|
|
|
repo_dir = script.scratch_path / "pip-test-package"
|
|
|
|
result = script.run("python", "setup.py", "develop", cwd=repo_dir / "subdir")
|
|
|
|
result = script.pip("freeze")
|
2019-09-24 02:28:40 +02:00
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""
|
|
|
|
...-e hg+...#egg=version_pkg&subdirectory=subdir
|
|
|
|
...
|
|
|
|
"""
|
|
|
|
).strip()
|
|
|
|
_check_output(result.stdout, expected)
|
2019-09-24 11:05:30 +02:00
|
|
|
|
|
|
|
|
2016-05-21 14:12:37 +02:00
|
|
|
@pytest.mark.git
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_git_remote(script: PipTestEnvironment) -> None:
|
2016-05-21 14:12:37 +02:00
|
|
|
"""
|
|
|
|
Test freezing a Git clone.
|
|
|
|
"""
|
|
|
|
# Returns path to a generated package called "version_pkg"
|
|
|
|
pkg_version = _create_test_package(script)
|
|
|
|
|
|
|
|
result = script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"git",
|
|
|
|
"clone",
|
|
|
|
pkg_version,
|
|
|
|
"pip-test-package",
|
2016-05-21 14:12:37 +02:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
repo_dir = script.scratch_path / "pip-test-package"
|
2016-05-21 14:12:37 +02:00
|
|
|
result = script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"python",
|
|
|
|
"setup.py",
|
|
|
|
"develop",
|
2016-05-21 14:12:37 +02:00
|
|
|
cwd=repo_dir,
|
|
|
|
expect_stderr=True,
|
|
|
|
)
|
|
|
|
origin_remote = pkg_version
|
|
|
|
# check frozen remote after clone
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
|
|
|
expected = (
|
|
|
|
textwrap.dedent(
|
|
|
|
"""
|
2016-05-21 14:12:37 +02:00
|
|
|
...-e git+{remote}@...#egg=version_pkg
|
|
|
|
...
|
|
|
|
"""
|
2021-08-13 15:23:45 +02:00
|
|
|
)
|
|
|
|
.format(remote=path_to_url(origin_remote))
|
|
|
|
.strip()
|
|
|
|
)
|
2016-05-21 14:12:37 +02:00
|
|
|
_check_output(result.stdout, expected)
|
|
|
|
# check frozen remote when there is no remote named origin
|
2021-08-13 15:23:45 +02:00
|
|
|
script.run("git", "remote", "rename", "origin", "other", cwd=repo_dir)
|
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
|
|
|
expected = (
|
|
|
|
textwrap.dedent(
|
|
|
|
"""
|
2016-05-21 14:12:37 +02:00
|
|
|
...-e git+{remote}@...#egg=version_pkg
|
|
|
|
...
|
|
|
|
"""
|
2021-08-13 15:23:45 +02:00
|
|
|
)
|
|
|
|
.format(remote=path_to_url(origin_remote))
|
|
|
|
.strip()
|
|
|
|
)
|
2021-04-21 11:06:41 +02:00
|
|
|
_check_output(result.stdout, expected)
|
2021-05-01 16:27:35 +02:00
|
|
|
# When the remote is a local path, it must exist.
|
|
|
|
# If it doesn't, it gets flagged as invalid.
|
2021-08-13 15:23:45 +02:00
|
|
|
other_remote = pkg_version + "-other"
|
|
|
|
script.run("git", "remote", "set-url", "other", other_remote, cwd=repo_dir)
|
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
|
|
|
expected = os.path.normcase(
|
|
|
|
textwrap.dedent(
|
|
|
|
f"""
|
2021-05-01 16:27:35 +02:00
|
|
|
...# Editable Git...(version-pkg...)...
|
|
|
|
# '{other_remote}'
|
|
|
|
-e {repo_dir}...
|
2021-04-21 11:06:41 +02:00
|
|
|
"""
|
2021-08-13 15:23:45 +02:00
|
|
|
).strip()
|
|
|
|
)
|
2021-05-01 16:27:35 +02:00
|
|
|
_check_output(os.path.normcase(result.stdout), expected)
|
2016-05-21 14:12:37 +02:00
|
|
|
# when there are more than one origin, priority is given to the
|
|
|
|
# remote named origin
|
2021-08-13 15:23:45 +02:00
|
|
|
script.run("git", "remote", "add", "origin", origin_remote, cwd=repo_dir)
|
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
|
|
|
expected = (
|
|
|
|
textwrap.dedent(
|
|
|
|
"""
|
2016-05-21 14:12:37 +02:00
|
|
|
...-e git+{remote}@...#egg=version_pkg
|
|
|
|
...
|
|
|
|
"""
|
2021-08-13 15:23:45 +02:00
|
|
|
)
|
|
|
|
.format(remote=path_to_url(origin_remote))
|
|
|
|
.strip()
|
|
|
|
)
|
2016-05-21 14:12:37 +02:00
|
|
|
_check_output(result.stdout, expected)
|
|
|
|
|
|
|
|
|
2017-10-06 21:51:42 +02:00
|
|
|
@need_mercurial
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_mercurial_clone(script: PipTestEnvironment) -> None:
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test freezing a Mercurial clone.
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
2015-03-12 05:53:43 +01:00
|
|
|
# Returns path to a generated package called "version_pkg"
|
2021-08-13 15:23:45 +02:00
|
|
|
pkg_version = _create_test_package(script, vcs="hg")
|
2015-03-12 05:53:43 +01:00
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"hg",
|
|
|
|
"clone",
|
|
|
|
pkg_version,
|
|
|
|
"pip-test-package",
|
2015-03-12 05:53:43 +01:00
|
|
|
expect_stderr=True,
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
repo_dir = script.scratch_path / "pip-test-package"
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"python",
|
|
|
|
"setup.py",
|
|
|
|
"develop",
|
2015-03-12 05:53:43 +01:00
|
|
|
cwd=repo_dir,
|
2014-01-28 15:17:51 +01:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
2014-01-28 15:17:51 +01:00
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""
|
2015-12-18 22:48:12 +01:00
|
|
|
...-e hg+...#egg=version_pkg
|
2014-01-28 15:17:51 +01:00
|
|
|
...
|
2015-03-12 05:53:43 +01:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
).strip()
|
2016-01-02 04:20:14 +01:00
|
|
|
_check_output(result.stdout, expected)
|
2010-02-24 11:24:55 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2017-10-06 21:51:42 +02:00
|
|
|
@need_bzr
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_bazaar_clone(script: PipTestEnvironment) -> None:
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test freezing a Bazaar clone.
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
2015-03-09 17:30:06 +01:00
|
|
|
try:
|
2021-08-13 15:23:45 +02:00
|
|
|
checkout_path = _create_test_package(script, vcs="bazaar")
|
2015-03-09 17:30:06 +01:00
|
|
|
except OSError as e:
|
2021-08-13 15:23:45 +02:00
|
|
|
pytest.fail(f"Invoking `bzr` failed: {e}")
|
2013-01-23 05:52:35 +01:00
|
|
|
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.run("bzr", "checkout", checkout_path, "bzr-package")
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.run(
|
2021-08-13 15:23:45 +02:00
|
|
|
"python",
|
|
|
|
"setup.py",
|
|
|
|
"develop",
|
|
|
|
cwd=script.scratch_path / "bzr-package",
|
2015-01-28 23:40:02 +01:00
|
|
|
expect_stderr=True,
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2015-12-18 22:48:12 +01:00
|
|
|
...-e bzr+file://...@1#egg=version_pkg
|
2021-08-13 15:23:45 +02:00
|
|
|
..."""
|
|
|
|
)
|
2016-01-02 04:20:14 +01:00
|
|
|
_check_output(result.stdout, expected)
|
2010-02-24 11:24:55 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2020-01-14 10:54:54 +01:00
|
|
|
@need_mercurial
|
|
|
|
@pytest.mark.git
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"outer_vcs, inner_vcs",
|
|
|
|
[("hg", "git"), ("git", "hg")],
|
|
|
|
)
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_nested_vcs(
|
|
|
|
script: PipTestEnvironment, outer_vcs: str, inner_vcs: str
|
|
|
|
) -> None:
|
2021-08-13 15:23:45 +02:00
|
|
|
"""Test VCS can be correctly freezed when resides inside another VCS repo."""
|
2020-01-14 10:54:54 +01:00
|
|
|
# Create Python package.
|
|
|
|
pkg_path = _create_test_package(script, vcs=inner_vcs)
|
|
|
|
|
|
|
|
# Create outer repo to clone into.
|
|
|
|
root_path = script.scratch_path.joinpath("test_freeze_nested_vcs")
|
|
|
|
root_path.mkdir()
|
|
|
|
root_path.joinpath(".hgignore").write_text("src")
|
|
|
|
root_path.joinpath(".gitignore").write_text("src")
|
|
|
|
_vcs_add(script, root_path, outer_vcs)
|
|
|
|
|
|
|
|
# Clone Python package into inner directory and install it.
|
|
|
|
src_path = root_path.joinpath("src")
|
|
|
|
src_path.mkdir()
|
|
|
|
script.run(inner_vcs, "clone", pkg_path, src_path, expect_stderr=True)
|
|
|
|
script.pip("install", "-e", src_path, expect_stderr=True)
|
|
|
|
|
|
|
|
# Check the freeze output recognizes the inner VCS.
|
|
|
|
result = script.pip("freeze", expect_stderr=True)
|
|
|
|
_check_output(
|
|
|
|
result.stdout,
|
2020-12-23 20:25:12 +01:00
|
|
|
f"...-e {inner_vcs}+...#egg=version_pkg\n...",
|
2020-01-14 10:54:54 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2016-05-26 12:45:46 +02:00
|
|
|
# used by the test_freeze_with_requirement_* tests below
|
2021-08-13 15:23:45 +02:00
|
|
|
_freeze_req_opts = textwrap.dedent(
|
|
|
|
"""\
|
2016-05-26 12:45:46 +02:00
|
|
|
# Unchanged requirements below this line
|
|
|
|
-r ignore.txt
|
|
|
|
--requirement ignore.txt
|
|
|
|
-f http://ignore
|
|
|
|
-i http://ignore
|
|
|
|
--pre
|
|
|
|
--trusted-host url
|
|
|
|
--process-dependency-links
|
|
|
|
--extra-index-url http://ignore
|
|
|
|
--find-links http://ignore
|
|
|
|
--index-url http://ignore
|
2020-07-19 11:44:12 +02:00
|
|
|
--use-feature 2020-resolver
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
2016-05-26 12:45:46 +02:00
|
|
|
|
|
|
|
|
2019-01-11 11:12:44 +01:00
|
|
|
def test_freeze_with_requirement_option_file_url_egg_not_installed(
|
2021-09-13 00:31:12 +02:00
|
|
|
script: PipTestEnvironment, deprecated_python: bool
|
|
|
|
) -> None:
|
2018-10-22 08:26:58 +02:00
|
|
|
"""
|
|
|
|
Test "freeze -r requirements.txt" with a local file URL whose egg name
|
|
|
|
is not installed.
|
|
|
|
"""
|
|
|
|
|
2021-08-13 15:23:45 +02:00
|
|
|
url = path_to_url("my-package.tar.gz") + "#egg=Does.Not-Exist"
|
|
|
|
requirements_path = script.scratch_path.joinpath("requirements.txt")
|
|
|
|
requirements_path.write_text(url + "\n")
|
2018-10-22 08:26:58 +02:00
|
|
|
|
|
|
|
result = script.pip(
|
2021-08-13 15:23:45 +02:00
|
|
|
"freeze",
|
|
|
|
"--requirement",
|
|
|
|
"requirements.txt",
|
|
|
|
expect_stderr=True,
|
2018-10-22 08:26:58 +02:00
|
|
|
)
|
|
|
|
expected_err = (
|
2021-08-13 15:23:45 +02:00
|
|
|
"WARNING: Requirement file [requirements.txt] contains {}, "
|
2019-01-26 23:20:14 +01:00
|
|
|
"but package 'Does.Not-Exist' is not installed\n"
|
2018-10-22 08:26:58 +02:00
|
|
|
).format(url)
|
2019-01-11 11:12:44 +01:00
|
|
|
if deprecated_python:
|
|
|
|
assert expected_err in result.stderr
|
|
|
|
else:
|
|
|
|
assert expected_err == result.stderr
|
2018-10-22 08:26:58 +02:00
|
|
|
|
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_with_requirement_option(script: PipTestEnvironment) -> None:
|
2011-12-04 07:00:10 +01:00
|
|
|
"""
|
|
|
|
Test that new requirements are created correctly with --requirement hints
|
|
|
|
|
|
|
|
"""
|
2016-05-26 12:45:46 +02:00
|
|
|
|
2021-08-13 15:23:45 +02:00
|
|
|
script.scratch_path.joinpath("hint1.txt").write_text(
|
|
|
|
textwrap.dedent(
|
|
|
|
"""\
|
2011-12-04 07:00:10 +01:00
|
|
|
INITools==0.1
|
2016-10-30 23:09:38 +01:00
|
|
|
NoExist==4.2 # A comment that ensures end of line comments work.
|
2015-05-31 00:58:16 +02:00
|
|
|
simple==3.0; python_version > '1.0'
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
+ _freeze_req_opts
|
|
|
|
)
|
|
|
|
script.scratch_path.joinpath("hint2.txt").write_text(
|
|
|
|
textwrap.dedent(
|
|
|
|
"""\
|
2019-08-11 09:27:06 +02:00
|
|
|
iniTools==0.1
|
|
|
|
Noexist==4.2 # A comment that ensures end of line comments work.
|
|
|
|
Simple==3.0; python_version > '1.0'
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
+ _freeze_req_opts
|
|
|
|
)
|
|
|
|
result = script.pip_install_local("initools==0.2")
|
|
|
|
result = script.pip_install_local("simple")
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2021-08-13 15:23:45 +02:00
|
|
|
"freeze",
|
|
|
|
"--requirement",
|
|
|
|
"hint1.txt",
|
2014-01-28 15:17:51 +01:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2016-05-26 12:45:46 +02:00
|
|
|
INITools==0.2
|
|
|
|
simple==3.0
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
2016-05-26 12:45:46 +02:00
|
|
|
expected += _freeze_req_opts
|
|
|
|
expected += "## The following requirements were added by pip freeze:..."
|
2016-01-02 04:20:14 +01:00
|
|
|
_check_output(result.stdout, expected)
|
|
|
|
assert (
|
2019-08-11 09:27:06 +02:00
|
|
|
"Requirement file [hint1.txt] contains NoExist==4.2, but package "
|
2018-10-22 08:26:58 +02:00
|
|
|
"'NoExist' is not installed"
|
2016-05-26 12:45:46 +02:00
|
|
|
) in result.stderr
|
2019-08-11 09:27:06 +02:00
|
|
|
result = script.pip(
|
2021-08-13 15:23:45 +02:00
|
|
|
"freeze",
|
|
|
|
"--requirement",
|
|
|
|
"hint2.txt",
|
2019-08-11 09:27:06 +02:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
|
|
|
_check_output(result.stdout, expected)
|
|
|
|
assert (
|
|
|
|
"Requirement file [hint2.txt] contains Noexist==4.2, but package "
|
|
|
|
"'Noexist' is not installed"
|
|
|
|
) in result.stderr
|
2016-05-26 12:45:46 +02:00
|
|
|
|
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_with_requirement_option_multiple(script: PipTestEnvironment) -> None:
|
2016-05-26 12:45:46 +02:00
|
|
|
"""
|
|
|
|
Test that new requirements are created correctly with multiple
|
|
|
|
--requirement hints
|
|
|
|
|
|
|
|
"""
|
2021-08-13 15:23:45 +02:00
|
|
|
script.scratch_path.joinpath("hint1.txt").write_text(
|
|
|
|
textwrap.dedent(
|
|
|
|
"""\
|
2016-05-26 12:45:46 +02:00
|
|
|
INITools==0.1
|
|
|
|
NoExist==4.2
|
|
|
|
simple==3.0; python_version > '1.0'
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
+ _freeze_req_opts
|
|
|
|
)
|
|
|
|
script.scratch_path.joinpath("hint2.txt").write_text(
|
|
|
|
textwrap.dedent(
|
|
|
|
"""\
|
2016-05-26 12:45:46 +02:00
|
|
|
NoExist2==2.0
|
|
|
|
simple2==1.0
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
+ _freeze_req_opts
|
|
|
|
)
|
|
|
|
result = script.pip_install_local("initools==0.2")
|
|
|
|
result = script.pip_install_local("simple")
|
|
|
|
result = script.pip_install_local("simple2==1.0")
|
|
|
|
result = script.pip_install_local("meta")
|
2016-05-26 12:45:46 +02:00
|
|
|
result = script.pip(
|
2021-08-13 15:23:45 +02:00
|
|
|
"freeze",
|
|
|
|
"--requirement",
|
|
|
|
"hint1.txt",
|
|
|
|
"--requirement",
|
|
|
|
"hint2.txt",
|
2016-05-26 12:45:46 +02:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2016-05-26 12:45:46 +02:00
|
|
|
INITools==0.2
|
|
|
|
simple==1.0
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
2016-05-26 12:45:46 +02:00
|
|
|
expected += _freeze_req_opts
|
2021-08-13 15:23:45 +02:00
|
|
|
expected += textwrap.dedent(
|
|
|
|
"""\
|
2016-05-26 12:45:46 +02:00
|
|
|
simple2==1.0
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
2016-05-26 12:45:46 +02:00
|
|
|
expected += "## The following requirements were added by pip freeze:"
|
2021-08-13 15:23:45 +02:00
|
|
|
expected += "\n" + textwrap.dedent(
|
|
|
|
"""\
|
2016-05-26 12:45:46 +02:00
|
|
|
...meta==1.0...
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
2016-05-26 12:45:46 +02:00
|
|
|
_check_output(result.stdout, expected)
|
|
|
|
assert (
|
2018-10-22 08:26:58 +02:00
|
|
|
"Requirement file [hint1.txt] contains NoExist==4.2, but package "
|
|
|
|
"'NoExist' is not installed"
|
2016-05-26 12:45:46 +02:00
|
|
|
) in result.stderr
|
|
|
|
assert (
|
2018-10-22 08:26:58 +02:00
|
|
|
"Requirement file [hint2.txt] contains NoExist2==2.0, but package "
|
|
|
|
"'NoExist2' is not installed"
|
2016-01-02 04:20:14 +01:00
|
|
|
) in result.stderr
|
2016-05-26 12:45:46 +02:00
|
|
|
# any options like '--index-url http://ignore' should only be emitted once
|
|
|
|
# even if they are listed in multiple requirements files
|
|
|
|
assert result.stdout.count("--index-url http://ignore") == 1
|
2014-10-14 21:07:50 +02:00
|
|
|
|
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_with_requirement_option_package_repeated_one_file(
|
|
|
|
script: PipTestEnvironment,
|
|
|
|
) -> None:
|
2017-10-31 06:43:46 +01:00
|
|
|
"""
|
|
|
|
Test freezing with single requirements file that contains a package
|
|
|
|
multiple times
|
|
|
|
"""
|
2021-08-13 15:23:45 +02:00
|
|
|
script.scratch_path.joinpath("hint1.txt").write_text(
|
|
|
|
textwrap.dedent(
|
|
|
|
"""\
|
2017-10-31 06:43:46 +01:00
|
|
|
simple2
|
|
|
|
simple2
|
|
|
|
NoExist
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
+ _freeze_req_opts
|
|
|
|
)
|
|
|
|
result = script.pip_install_local("simple2==1.0")
|
|
|
|
result = script.pip_install_local("meta")
|
2017-10-31 06:43:46 +01:00
|
|
|
result = script.pip(
|
2021-08-13 15:23:45 +02:00
|
|
|
"freeze",
|
|
|
|
"--requirement",
|
|
|
|
"hint1.txt",
|
2017-10-31 06:43:46 +01:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
expected_out = textwrap.dedent(
|
|
|
|
"""\
|
2017-10-31 06:43:46 +01:00
|
|
|
simple2==1.0
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
2017-10-31 06:43:46 +01:00
|
|
|
expected_out += _freeze_req_opts
|
|
|
|
expected_out += "## The following requirements were added by pip freeze:"
|
2021-08-13 15:23:45 +02:00
|
|
|
expected_out += "\n" + textwrap.dedent(
|
|
|
|
"""\
|
2017-10-31 06:43:46 +01:00
|
|
|
...meta==1.0...
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
2017-10-31 06:43:46 +01:00
|
|
|
_check_output(result.stdout, expected_out)
|
2021-08-13 15:23:45 +02:00
|
|
|
err1 = (
|
|
|
|
"Requirement file [hint1.txt] contains NoExist, "
|
|
|
|
"but package 'NoExist' is not installed\n"
|
|
|
|
)
|
2017-10-31 06:43:46 +01:00
|
|
|
err2 = "Requirement simple2 included multiple times [hint1.txt]\n"
|
|
|
|
assert err1 in result.stderr
|
|
|
|
assert err2 in result.stderr
|
|
|
|
# there shouldn't be any other 'is not installed' warnings
|
2021-08-13 15:23:45 +02:00
|
|
|
assert result.stderr.count("is not installed") == 1
|
2017-10-31 06:43:46 +01:00
|
|
|
|
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_with_requirement_option_package_repeated_multi_file(
|
|
|
|
script: PipTestEnvironment,
|
|
|
|
) -> None:
|
2017-10-31 06:43:46 +01:00
|
|
|
"""
|
|
|
|
Test freezing with multiple requirements file that contain a package
|
|
|
|
"""
|
2021-08-13 15:23:45 +02:00
|
|
|
script.scratch_path.joinpath("hint1.txt").write_text(
|
|
|
|
textwrap.dedent(
|
|
|
|
"""\
|
2017-10-31 06:43:46 +01:00
|
|
|
simple
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
+ _freeze_req_opts
|
|
|
|
)
|
|
|
|
script.scratch_path.joinpath("hint2.txt").write_text(
|
|
|
|
textwrap.dedent(
|
|
|
|
"""\
|
2017-10-31 06:43:46 +01:00
|
|
|
simple
|
|
|
|
NoExist
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
|
|
|
+ _freeze_req_opts
|
|
|
|
)
|
|
|
|
result = script.pip_install_local("simple==1.0")
|
|
|
|
result = script.pip_install_local("meta")
|
2017-10-31 06:43:46 +01:00
|
|
|
result = script.pip(
|
2021-08-13 15:23:45 +02:00
|
|
|
"freeze",
|
|
|
|
"--requirement",
|
|
|
|
"hint1.txt",
|
|
|
|
"--requirement",
|
|
|
|
"hint2.txt",
|
2017-10-31 06:43:46 +01:00
|
|
|
expect_stderr=True,
|
|
|
|
)
|
2021-08-13 15:23:45 +02:00
|
|
|
expected_out = textwrap.dedent(
|
|
|
|
"""\
|
2017-10-31 06:43:46 +01:00
|
|
|
simple==1.0
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
2017-10-31 06:43:46 +01:00
|
|
|
expected_out += _freeze_req_opts
|
|
|
|
expected_out += "## The following requirements were added by pip freeze:"
|
2021-08-13 15:23:45 +02:00
|
|
|
expected_out += "\n" + textwrap.dedent(
|
|
|
|
"""\
|
2017-10-31 06:43:46 +01:00
|
|
|
...meta==1.0...
|
2021-08-13 15:23:45 +02:00
|
|
|
"""
|
|
|
|
)
|
2017-10-31 06:43:46 +01:00
|
|
|
_check_output(result.stdout, expected_out)
|
|
|
|
|
2021-08-13 15:23:45 +02:00
|
|
|
err1 = (
|
|
|
|
"Requirement file [hint2.txt] contains NoExist, but package "
|
|
|
|
"'NoExist' is not installed\n"
|
|
|
|
)
|
2021-08-13 15:25:41 +02:00
|
|
|
err2 = "Requirement simple included multiple times [hint1.txt, hint2.txt]\n"
|
2017-10-31 06:43:46 +01:00
|
|
|
assert err1 in result.stderr
|
|
|
|
assert err2 in result.stderr
|
|
|
|
# there shouldn't be any other 'is not installed' warnings
|
2021-08-13 15:23:45 +02:00
|
|
|
assert result.stderr.count("is not installed") == 1
|
2017-10-31 06:43:46 +01:00
|
|
|
|
|
|
|
|
2017-05-14 00:47:17 +02:00
|
|
|
@pytest.mark.network
|
2019-11-05 16:35:08 +01:00
|
|
|
@pytest.mark.incompatible_with_test_venv
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_user(
|
|
|
|
script: PipTestEnvironment, virtualenv: VirtualEnvironment, data: TestData
|
|
|
|
) -> None:
|
2014-10-14 21:07:50 +02:00
|
|
|
"""
|
|
|
|
Testing freeze with --user, first we have to install some stuff.
|
|
|
|
"""
|
2021-08-13 15:23:45 +02:00
|
|
|
script.pip("download", "setuptools", "wheel", "-d", data.packages)
|
|
|
|
script.pip_install_local("--find-links", data.find_links, "--user", "simple==2.0")
|
|
|
|
script.pip_install_local("--find-links", data.find_links, "simple2==3.0")
|
|
|
|
result = script.pip("freeze", "--user", expect_stderr=True)
|
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2014-10-16 10:11:27 +02:00
|
|
|
simple==2.0
|
2021-08-13 15:23:45 +02:00
|
|
|
<BLANKLINE>"""
|
|
|
|
)
|
2016-01-02 04:20:14 +01:00
|
|
|
_check_output(result.stdout, expected)
|
2021-08-13 15:23:45 +02:00
|
|
|
assert "simple2" not in result.stdout
|
2019-05-28 11:28:18 +02:00
|
|
|
|
|
|
|
|
Mark 6 tests as network tests
=================================== 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
2019-11-15 19:44:54 +01:00
|
|
|
@pytest.mark.network
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_path(tmpdir: Path, script: PipTestEnvironment, data: TestData) -> None:
|
2019-05-28 11:28:18 +02:00
|
|
|
"""
|
|
|
|
Test freeze with --path.
|
|
|
|
"""
|
2021-08-13 15:23:45 +02:00
|
|
|
script.pip(
|
|
|
|
"install", "--find-links", data.find_links, "--target", tmpdir, "simple==2.0"
|
|
|
|
)
|
|
|
|
result = script.pip("freeze", "--path", tmpdir)
|
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2019-05-28 11:28:18 +02:00
|
|
|
simple==2.0
|
2021-08-13 15:23:45 +02:00
|
|
|
<BLANKLINE>"""
|
|
|
|
)
|
2019-05-28 11:28:18 +02:00
|
|
|
_check_output(result.stdout, expected)
|
|
|
|
|
|
|
|
|
Mark 6 tests as network tests
=================================== 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
2019-11-15 19:44:54 +01:00
|
|
|
@pytest.mark.network
|
2019-11-05 16:35:08 +01:00
|
|
|
@pytest.mark.incompatible_with_test_venv
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_path_exclude_user(
|
|
|
|
tmpdir: Path, script: PipTestEnvironment, data: TestData
|
|
|
|
) -> None:
|
2019-05-28 11:28:18 +02:00
|
|
|
"""
|
|
|
|
Test freeze with --path and make sure packages from --user are not picked
|
|
|
|
up.
|
|
|
|
"""
|
2021-08-13 15:23:45 +02:00
|
|
|
script.pip_install_local("--find-links", data.find_links, "--user", "simple2")
|
|
|
|
script.pip(
|
|
|
|
"install", "--find-links", data.find_links, "--target", tmpdir, "simple==1.0"
|
|
|
|
)
|
|
|
|
result = script.pip("freeze", "--user")
|
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2019-05-28 11:28:18 +02:00
|
|
|
simple2==3.0
|
2021-08-13 15:23:45 +02:00
|
|
|
<BLANKLINE>"""
|
|
|
|
)
|
2019-05-28 11:28:18 +02:00
|
|
|
_check_output(result.stdout, expected)
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", "--path", tmpdir)
|
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2019-05-28 11:28:18 +02:00
|
|
|
simple==1.0
|
2021-08-13 15:23:45 +02:00
|
|
|
<BLANKLINE>"""
|
|
|
|
)
|
2019-05-28 11:28:18 +02:00
|
|
|
_check_output(result.stdout, expected)
|
|
|
|
|
|
|
|
|
Mark 6 tests as network tests
=================================== 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
2019-11-15 19:44:54 +01:00
|
|
|
@pytest.mark.network
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_path_multiple(
|
|
|
|
tmpdir: Path, script: PipTestEnvironment, data: TestData
|
|
|
|
) -> None:
|
2019-05-28 11:28:18 +02:00
|
|
|
"""
|
|
|
|
Test freeze with multiple --path arguments.
|
|
|
|
"""
|
|
|
|
path1 = tmpdir / "path1"
|
|
|
|
os.mkdir(path1)
|
|
|
|
path2 = tmpdir / "path2"
|
|
|
|
os.mkdir(path2)
|
2021-08-13 15:23:45 +02:00
|
|
|
script.pip(
|
|
|
|
"install", "--find-links", data.find_links, "--target", path1, "simple==2.0"
|
|
|
|
)
|
|
|
|
script.pip(
|
|
|
|
"install", "--find-links", data.find_links, "--target", path2, "simple2==3.0"
|
|
|
|
)
|
|
|
|
result = script.pip("freeze", "--path", path1)
|
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2019-05-28 11:28:18 +02:00
|
|
|
simple==2.0
|
2021-08-13 15:23:45 +02:00
|
|
|
<BLANKLINE>"""
|
|
|
|
)
|
2019-05-28 11:28:18 +02:00
|
|
|
_check_output(result.stdout, expected)
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", "--path", path1, "--path", path2)
|
|
|
|
expected = textwrap.dedent(
|
|
|
|
"""\
|
2019-05-28 11:28:18 +02:00
|
|
|
simple==2.0
|
|
|
|
simple2==3.0
|
2021-08-13 15:23:45 +02:00
|
|
|
<BLANKLINE>"""
|
|
|
|
)
|
2019-05-28 11:28:18 +02:00
|
|
|
_check_output(result.stdout, expected)
|
2020-02-01 13:40:35 +01:00
|
|
|
|
|
|
|
|
2021-09-21 06:44:29 +02:00
|
|
|
@pytest.mark.usefixtures("with_wheel")
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_direct_url_archive(
|
|
|
|
script: PipTestEnvironment, shared_data: TestData
|
|
|
|
) -> None:
|
2020-04-08 10:29:33 +02:00
|
|
|
req = "simple @ " + path_to_url(shared_data.packages / "simple-2.0.tar.gz")
|
|
|
|
assert req.startswith("simple @ file://")
|
|
|
|
script.pip("install", req)
|
|
|
|
result = script.pip("freeze")
|
|
|
|
assert req in result.stdout
|
|
|
|
|
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_skip_work_dir_pkg(script: PipTestEnvironment) -> None:
|
2020-04-05 19:47:03 +02:00
|
|
|
"""
|
|
|
|
Test that freeze should not include package
|
|
|
|
present in working directory
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Create a test package and create .egg-info dir
|
2021-08-13 15:23:45 +02:00
|
|
|
pkg_path = create_test_package_with_setup(script, name="simple", version="1.0")
|
|
|
|
script.run("python", "setup.py", "egg_info", expect_stderr=True, cwd=pkg_path)
|
2020-04-05 19:47:03 +02:00
|
|
|
|
|
|
|
# Freeze should not include package simple when run from package directory
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", cwd=pkg_path)
|
|
|
|
assert "simple" not in result.stdout
|
2020-04-05 19:47:03 +02:00
|
|
|
|
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
def test_freeze_include_work_dir_pkg(script: PipTestEnvironment) -> None:
|
2020-04-05 19:47:03 +02:00
|
|
|
"""
|
|
|
|
Test that freeze should include package in working directory
|
|
|
|
if working directory is added in PYTHONPATH
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Create a test package and create .egg-info dir
|
2021-08-13 15:23:45 +02:00
|
|
|
pkg_path = create_test_package_with_setup(script, name="simple", version="1.0")
|
|
|
|
script.run("python", "setup.py", "egg_info", expect_stderr=True, cwd=pkg_path)
|
2020-04-05 19:47:03 +02:00
|
|
|
|
2021-08-13 15:23:45 +02:00
|
|
|
script.environ.update({"PYTHONPATH": pkg_path})
|
2020-04-05 19:47:03 +02:00
|
|
|
|
2020-04-08 10:29:33 +02:00
|
|
|
# Freeze should include package simple when run from package directory,
|
|
|
|
# when package directory is in PYTHONPATH
|
2021-08-13 15:23:45 +02:00
|
|
|
result = script.pip("freeze", cwd=pkg_path)
|
|
|
|
assert "simple==1.0" in result.stdout
|
2021-08-01 10:48:27 +02:00
|
|
|
|
|
|
|
|
2021-09-13 00:31:12 +02:00
|
|
|
@pytest.mark.usefixtures("with_wheel")
|
|
|
|
def test_freeze_pep610_editable(script: PipTestEnvironment) -> None:
|
2021-08-01 10:48:27 +02:00
|
|
|
"""
|
|
|
|
Test that a package installed with a direct_url.json with editable=true
|
|
|
|
is correctly frozeon as editable.
|
|
|
|
"""
|
|
|
|
pkg_path = _create_test_package(script, name="testpkg")
|
|
|
|
result = script.pip("install", pkg_path)
|
|
|
|
direct_url_path = get_created_direct_url_path(result, "testpkg")
|
|
|
|
assert direct_url_path
|
|
|
|
# patch direct_url.json to simulate an editable install
|
|
|
|
with open(direct_url_path) as f:
|
|
|
|
direct_url = DirectUrl.from_json(f.read())
|
2021-09-13 00:31:12 +02:00
|
|
|
assert isinstance(direct_url.info, DirInfo)
|
2021-08-01 10:48:27 +02:00
|
|
|
direct_url.info.editable = True
|
|
|
|
with open(direct_url_path, "w") as f:
|
|
|
|
f.write(direct_url.to_json())
|
|
|
|
result = script.pip("freeze")
|
|
|
|
assert "# Editable Git install with no remote (testpkg==0.1)" in result.stdout
|