Commit Graph

2933 Commits

Author SHA1 Message Date
Tzu-ping Chung e5c43ed6af Add tests for get_repository_root 2020-01-14 16:45:28 +08:00
Tzu-ping Chung cdd7821d92 Fix incorrect quoting Link.url
Cherry-picked manually from atugushev:fix-issue-6446.

Co-Authored-By: Albert Tugushev <albert@tugushev.ru>
2020-01-14 16:12:11 +08:00
Christopher Hunt cf722df4f9
Merge pull request #7581 from chrahunt/refactor/split-install-tests
Split relative requirement install tests
2020-01-14 01:40:29 +08:00
Pradyun Gedam b411cdbdf5
Azure Pipelines: Test Windows on Python 3.8 (#7320) 2020-01-13 12:33:43 +00:00
Tzu-ping Chung 2d3f2cdba5 Delete a file to let --force-reinstall fix it 2020-01-13 18:04:52 +08:00
Christopher Hunt 7e65a5a40f
Merge pull request #7578 from uranusjr/test-uppercase-console-scripts
Add test for uppercase script name
2020-01-13 09:42:38 +08:00
Chris Hunt 8d92e40c1f Use USERPROFILE in expanduser test
In Python 3.8, expanduser on Windows no longer respects HOME, per
https://bugs.python.org/issue36264.
2020-01-12 19:44:43 -05:00
Tzu-ping Chung 8e72502118 Add test for uppercase script name 2020-01-12 17:16:52 +08:00
Tzu-ping Chung 4def73ca3a Refactor test to remove unneeded network dep 2020-01-12 17:12:08 +08:00
Tzu-ping Chung 10022df906 Rename test to make its intention clearer 2020-01-12 17:03:28 +08:00
Chris Hunt e53d10db01 Remove unnecessary uninstall
Since a new temporary script path is used for each test, no need to do
uninstall.
2020-01-11 19:39:12 -05:00
Chris Hunt f89013daa4 Parametrize editable for relative install tests 2020-01-11 19:37:10 -05:00
Chris Hunt 2801de5825 Parametrize long relative install tests
This lets us make better use of parallelization and will let us remove
the unnecessary uninstallation from these individual tests.
2020-01-11 19:32:44 -05:00
Chris Hunt 0a57e4e9f2 Manage temp directory deletion centrally
This gives us a global toggle that we can use to control whether
temporary directories get deleted from one place (ideally, in the
commands taking --no-clean).
2020-01-10 11:08:05 +01:00
Tzu-ping Chung facf5c8894 Add comments to unicode workarounds 2020-01-09 13:11:30 +05:30
Tzu-ping Chung 7a80acaf44 Tell shutil.make_archive to use Unicode paths
By default, make_archive uses str paths on Python 2, which causes it to
skip files with unencodable names. By passing in a unicode base_dir
explicitly, it is smart enough to use unicode all the way down instead.
2020-01-09 13:01:31 +05:30
Tzu-ping Chung 37f97140af Also use rmtree to remove tmpdir_factory
Same as e2c3451001
2020-01-09 13:00:49 +05:30
Xavier Fernandez fe3e892a93
Merge pull request #7354 from chrahunt/maint/use-packaging-tags
Use packaging.tags for doing compatible wheel tag calculation
2020-01-08 22:41:35 +01:00
Tzu-ping Chung e2c3451001 Delete tmpdir with rmtree to handle Unicode paths
pytest (rather py.path.local) does not handle non-ASCII paths properly
on Windows with Python 2, but Python's builtin shutil.rmtree() does.

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2020-01-08 18:26:42 +05:30
Stéphane Bidoul (ACSONE) 8ce0859012
Remove redundant expanduser in WheelCache
Path normalization, which includes expanduser is now
done eagerly. Assert this when initializing
WheelCache.
2020-01-08 08:02:29 +01:00
Chris Hunt 896317d13d Remove unused abi functions
Previously, these were used when the user did not provide an explicit
ABI. Now this is handled internally in `packaging.tags` (by
`_cpython_abi` and `_generic_abi`).
2020-01-07 19:01:05 -05:00
Chris Hunt 7aaa705c15 Remove unused glibc functions
The remaining glibc-related functions are required to allow us to put
the libc version in the pip user agent (for stats).
2020-01-07 19:01:00 -05:00
Chris Hunt 2455977bc8 Remove unused manylinux auto-deduction functions 2020-01-07 19:00:55 -05:00
Chris Hunt 5dbef5debe Use packaging.tags.cpython_tags
We assume this function improves the status quo over the current
`_cpython_tags`, so we use it when no arguments need to be customized.

Since `packaging.tags` has its own tests and derives defaults
differently than pep425tags, we also remove the applicable tests that
were testing against the result of a plain call to
`pep425tags.get_supported()`.
2020-01-07 18:59:44 -05:00
Chris Hunt 4659a78935 Use packaging.tags.compatible_tags
We assume this function improves on our existing behavior, so use it
as-is. We will customize the arguments over the next few commits.

Since packaging.tags internally calculates platforms when not provided,
we skip the tests which patch functions assuming that manylinux
compatibility determination depends on them.
2020-01-07 18:55:26 -05:00
Pradyun Gedam ea27521359
Custom optparse.Option type that calls expanduser (#7534) 2020-01-07 12:26:38 +00:00
Pradyun Gedam 6c515125c2
Merge pradyunsg:revert/6864 into master (#7557)
Revert addition of un-suffixed pip CLI entry points for invocation check on Windows
2020-01-07 08:16:38 +00:00
Pradyun Gedam 4ee779f79e
Drop no longer valid tests 2020-01-07 12:25:11 +05:30
Chris Hunt 58f175fdf2 Remove unused format_tag
Since we delegate tag formatting to packaging.tags.Tag, we don't need
this function or its tests.
2020-01-07 01:42:42 -05:00
Chris Hunt 80b2c82d0c Use packaging.tags.Tag in place of Tuple
This is the standard type used by packaging.tags. Making this change
throughout the code lets us start switching over to using its
tag-generating functions in get_supported().

We also get rid of a test, since it was superseded by `__str__` in
packaging.tags.Tag.
2020-01-07 01:42:42 -05:00
Chris Hunt 893faa9e44 Replace get_abbr_impl with interpreter_name
This reduces the amount of code we have to manage.

interpreter_name is calculated differently, defaulting to the
long name of the interpreter rather than "cp", but that is more
conformant.
2020-01-06 18:27:51 -05:00
Chris Hunt 4b5614c9e2 Replace get_impl_ver with interpreter_version 2020-01-06 18:27:27 -05:00
Pradyun Gedam d9d801f818
Drop no-suffix checks for pip-from-PATH 2020-01-06 19:29:56 +05:30
Stéphane Bidoul (ACSONE) f04e6ab7b5
Split should_build test
Separately test should_build_for_wheel_command
and should_buid_for_install_command.
The tests are simpler and this open the door
for reasoning about both functions independently.
2020-01-05 23:52:42 +01:00
Stéphane Bidoul (ACSONE) 9729273ca8
Make should_build and should_cache "private" 2020-01-05 23:52:42 +01:00
Stéphane Bidoul (ACSONE) 870106b9bb
Simplify _collect_buildset
Since filtering of what to build has been
done beforehand, there is no need to filter
again here anymore.
2020-01-05 23:52:41 +01:00
Stéphane Bidoul (ACSONE) 8ca8e9bf61
Extend should_build scope wrt legacy requirements
We don't build legacy requirements
when wheel is not installed because
we'll fallback to a legacy install in such case.
2020-01-05 23:52:40 +01:00
Stéphane Bidoul (ACSONE) 4bdca1a09a
Remove now useless build_wheels function 2020-01-05 23:52:40 +01:00
Chris Hunt 33043ba22f Use pkg_resources.Distribution derived from wheel directly
We now extract all metadata files from the wheel directly into memory
and make them available to the wrapping pkg_resources.Distribution via
the DictMetadata introduced earlier.
2020-01-05 10:57:14 -05:00
Chris Hunt ae34781826 Parameterize wheel file path for metadata extraction 2020-01-04 20:50:17 -05:00
Chris Hunt 20706eb93f Add DictMetadata for adapting zip data to Distribution
pkg_resources.Distribution classes delegate to the IMetadataProvider
implementation provided at construction. This is the one we'll use for
adapting a ZipFile to pkg_resources.DistInfoDistribution.
2020-01-04 20:49:41 -05:00
Christopher Hunt c3ab0a0b13
Merge pull request #7552 from chrahunt/refactor/cleanup-wheel-install-tests
Make wheel install test packages more explicit
2020-01-05 08:46:07 +08:00
Chris Hunt b263fcc105 Move parse_wheel and supporting functions to utils.wheel
In order to parse metadata from wheel files directly we want to reuse
parse_wheel. Moving it out helps avoid creating an unnecessary
dependence on operations.install.wheel.
2020-01-04 23:11:51 +01:00
Chris Hunt b58205ea01 Use valid wheel for functional download tests
Previously we were copying an existing wheel to a file with a
different distribution name. When using stricter metadata parsing this
would fail, so now we use a more conformant dummy wheel function.
2020-01-04 23:08:43 +01:00
Chris Hunt b65bd4c31a Remove unused args parameter from _git_commit 2020-01-03 19:24:22 -05:00
Chris Hunt 5665b94a5b Make explicit argument for git commit -a 2020-01-03 19:21:36 -05:00
Chris Hunt f9bf1a7004 Make explicit argument for git commit --allow-empty 2020-01-03 19:19:18 -05:00
Chris Hunt 79eaf132fc Remove unnecessary expect_stderr from _git_commit
This simplifies our interface to git, which will make it easier to trade
out our subprocess-based invocations in the future.
2020-01-03 19:13:08 -05:00
Chris Hunt f5684ed7ae Use shared_data fixture in wheel install tests
shared_data avoids copying the entire data directory, so use it in cases
where we know pip won't have any opportunity to edit the data files
(where we're passing tmpdir for --find-links).
2020-01-03 18:25:02 -05:00
Chris Hunt d468da2796 Explicitly copy required packages to tmpdir for wheel install tests
Any test using --find-links data.packages is potentially using several
packages. By copying specifically the packages we need, we can more
easily see the packages that each test depends on and avoid using the
`data` fixture.
2020-01-03 18:23:48 -05:00
Chris Hunt 4e5d854456 Normalize --find-links argument format in wheel install tests 2020-01-03 17:58:40 -05:00
Chris Hunt 7af9371176 Remove redundant expect_error=False in tests
This is the default, so there is no need to specify it explicitly.
2020-01-03 14:25:36 +01:00
Pradyun Gedam 08f61a9b73
Do not attempt setup.py clean for failed pep517 builds (#7477) 2020-01-02 12:11:32 +00:00
Stéphane Bidoul (ACSONE) c93acfb20b
Test legacy clean not attempt after PEP 517 build failure 2020-01-02 12:14:03 +01:00
Tzu-ping Chung 5ffc6bd468 Add tests for global path options 2020-01-02 18:58:42 +08:00
Chris Hunt d5b4c15105 Remove dead code from wheel_metadata
Since we don't pass the source directory anymore, remove the tests
and implementation.
2020-01-01 17:51:24 -05:00
Chris Hunt a2af0f9468 Get WHEEL metadata from wheel file directly 2020-01-01 17:26:20 -05:00
Chris Hunt 62721eb5da Remove dead code
Since we don't pass the source dir anymore, we can simplify the tests
and implementation for wheel_dist_info_dir.
2020-01-01 17:26:20 -05:00
Chris Hunt cd5400ceb9 Determine .dist-info directory from wheel file directly
First example of transitioning a directory-aware function to using a
zipfile directly. Since we will not need to maintain the unpacked dir
going forward, we don't need to worry about making wheel_dist_info_dir
"generic", just that the same tests pass for both cases at each commit.

To do this neatly we use pytest.fixture(params=[...]), which
generates a test for each param. Once we've transitioned the
necessary functions we only need to replace the fixture name and remove
the dead code.
2020-01-01 17:26:20 -05:00
Chris Hunt 452acd5e76 Add files in .dist-info directory tests
Since zips don't typically contain directory entries, we want to
only operate on files. Adding files to the .dist-info tests means we
will be able to reuse them for both cases, while they coexist.
2020-01-01 17:26:20 -05:00
Christopher Hunt b2f596ba2b
Merge pull request #7536 from chrahunt/refactor/extract-wheel-info-functions
Refactor wheel info extraction during install
2020-01-02 06:25:33 +08:00
Chris Hunt 010c24d64c Take .dist-info dir directly in wheel_metadata
Since retrieval of the .dist-info dir already ensures that a
distribution is found, this reduces responsibility on wheel_metadata and
lets us remove a few tests already covered by the tests for
test_wheel_dist_info_dir_*.
2020-01-01 12:25:01 -05:00
Chris Hunt fc48a17206 Simplify positive wheel_version unit test 2020-01-01 12:25:01 -05:00
Chris Hunt 6c56557fbe Remove unused req_description from wheel_dist_info_dir 2020-01-01 12:25:01 -05:00
Chris Hunt e1c7de8861 Raise UnsupportedWheel instead of AssertionError, and let caller add name 2020-01-01 12:25:01 -05:00
Chris Hunt 32115b55af Extract getting wheel .dist-info directory into a separate function 2020-01-01 12:10:22 -05:00
Christopher Hunt ab7e4769db
Merge pull request #7520 from chrahunt/maint/cross-platform-lints
Run linters/docs on Windows and macOS
2020-01-01 23:48:56 +08:00
Chris Hunt c9b0742508 Remove old root_is_purelib
The _invalidversion_ tests are not applicable to the new function since
we do not use a regex to find the applicable folder.
2019-12-31 12:49:08 -05:00
Chris Hunt 42c6dd78b9 Use WHEEL metadata to determine Root-Is-Purelib 2019-12-31 12:47:01 -05:00
Chris Hunt ca729c89de Simplify wheel_version tests 2019-12-31 12:35:53 -05:00
Chris Hunt d66bc398be Split wheel_metadata from wheel_version
This will let us re-use the wheel_metadata for other parts of
processing, and by parameterizing checks in terms of metadata we will be
able to substitute in metadata derived directly from the zip.
2019-12-31 12:35:52 -05:00
Christopher Hunt 69143848b0
Make WHEEL file errors more explicit (#7529)
* Raise exception on exception in finding wheel dist

We plan to replace this code with direct extraction from a zip, so no
point catching anything more precise.

* Raise exception if no dist is found in wheel_version
* Catch file read errors when reading WHEEL

get_metadata delegates to the underlying implementation which tries
to locate and read the file, throwing an IOError (Python 2) or OSError
subclass on any errors.

Since the new explicit test checks the same case as brokenwheel in
test_wheel_version we remove the redundant test.

* Check for WHEEL decoding errors explicitly

This was the last error that could be thrown by get_metadata, so we can
also remove the catch-all except block.

* Move WHEEL parsing outside try...except

This API does not raise an exception, but returns any errors on the
message object itself. We are preserving the original behavior, and can
decide later whether to start warning or raising our own exception.

* Raise explicit error if Wheel-Version is missing

`email.message.Message.__getitem__` returns None on missing values, so
we have to check for ourselves explicitly.

* Raise explicit exception on failure to parse Wheel-Version

This is also the last exception that can be raised, so we remove
`except Exception`.

* Remove dead code

Since wheel_version never returns None, this exception will never be
raised.
2019-12-31 23:17:41 +08:00
Christopher Hunt e8ded43035
Merge pull request #7523 from sbidoul/wheel-builder-disentangle-7-sbi
Further reduce responsibility of WheelBuilder
2019-12-31 08:32:29 +08:00
Christopher Hunt 8c888a2287
Simplify getting info directories for wheel installation (#7526)
* Edit subdirs of top-level instead of checking in each directory

Previously, we were checking whether the top of the relative path ended
with .data. Now, we do not recurse into those directories, so there's no
need to check every time.

* Store info_dir in separate variable

Instead of working with a list everywhere, we use the single info_dir.

* Separate variables for info_dir and the destination path
* Use destination .dist-info dir only when needed

By initially storing just the name of the folder we ensure our code is
agnostic to the destination, so it'll be easier to install from a zip
later.

* Use os.listdir instead of os.walk for wheel dir population

Since we only execute any code when basedir == '', we only need the
top-level directories.

* Inline data_dirs calculation
* Inline info_dirs calculation
2019-12-30 23:59:23 +08:00
Stéphane Bidoul (ACSONE) 261c286de9
Make wheel_cache an argument of build() 2019-12-29 18:51:45 +01:00
Stéphane Bidoul (ACSONE) 3828699ddc
Move build options from WheelBuilder to build function 2019-12-29 18:49:54 +01:00
Christopher Hunt dc860e865e
Merge pull request #7519 from chrahunt/bugfix/restrict-two-dist-info-dirs-toplevel-only
Only check for .dist-info directories at the top-level
2019-12-29 20:16:25 +08:00
Christopher Hunt 711cf4deaf
Merge pull request #7517 from sbidoul/wheel-builder-disentangle-6-sbi
Move final wheel builder copy operation to wheel command
2019-12-29 13:46:02 +08:00
Chris Hunt 8dc6919875 Fix mypy checks on Windows
Previously we were making unguarded calls to non-Windows-only APIs. Mypy
only automatically excludes these from platform-specific checks when
inside conditions.
2019-12-29 00:33:28 -05:00
Chris Hunt 93900e1199 Only check for .dist-info directories at the top-level
Previously we were restricting to a single .dist-info directory anywhere
in the unpacked wheel directory. That was incorrect since only a
top-level .dist-info directory indicates a contained "package". Now we
limit our restriction to top-level .dist-info directories.
2019-12-28 15:49:08 -05:00
Pradyun Gedam 7420629800
Effectively disable the wheel cache if not writable (#7489) 2019-12-28 18:56:05 +00:00
Stéphane Bidoul (ACSONE) 1ee270a8d4
Check that the cache is writable in _main()
This avoid code duplication (for the wheel and http
cache) and repeated warnings.
2019-12-28 13:04:54 +01:00
Stéphane Bidoul (ACSONE) 865539bdad
Test that pip wheel succeeds when cache dir is not writeable 2019-12-28 13:04:40 +01:00
Stéphane Bidoul (ACSONE) cf21401fd7
Make wheelbuilder.build return successes too
Also, pluralize variable names for readability and consistency with
similar variables in callers.
2019-12-26 21:43:57 +01:00
Pradyun Gedam 37f3fd7087
Move legacy wheel build process 2019-12-25 17:52:39 +05:30
Christopher Hunt 0292938f89
Merge pull request #7501 from uranusjr/appdirs-patch 2019-12-24 23:30:55 +08:00
Tzu-ping Chung c98c0ad79c Default to /etc/xdg if XDG_CONFIG_DIRS if empty 2019-12-23 14:33:17 +08:00
Christopher Hunt 92da786643
Merge pull request #7494 from chrahunt/refactor/wheel-metadata-retrieval
Only allow one top-level .dist-info directory in wheels
2019-12-23 05:41:30 +08:00
Christopher Hunt 3f4bb75fa4
Merge pull request #7499 from chrahunt/feature/add-old-entrypoints
Add old pip entrypoints
2019-12-23 05:40:10 +08:00
Chris Hunt e5495cf6a1 Raise UnsupportedWheel when .dist-info doesn't match name
This aligns with the previous behavior that would have enforced the
found .dist-info directory starting with the name of the package.

We raise UnsupportedWheel because it looks better in output than the
AssertionError (which includes traceback).
2019-12-21 21:27:49 -05:00
Chris Hunt 0d865d8fe3 Add test for multiple .dist-info in wheel 2019-12-21 10:51:57 -05:00
Pradyun Gedam c06874c471
Merge pull request #7490 from sbidoul/legacy-cache-bug-sbi
Fix cache bug with legacy cache entries
2019-12-21 07:27:46 +00:00
Chris Hunt 38585adaec Add warning when using old console script wrappers
We use sys.stderr instead of our `deprecated` helper because logging is
not set up at the time this is executed.
2019-12-20 22:01:25 -05:00
Tzu-ping Chung 2ccc5c055d Match site_config_dirs for empty XDG_CONFIG_DIRS 2019-12-20 14:36:30 +08:00
Chris Hunt 241679e6c2 Setup old entrypoints in pip module
This should make everything "just work" with respect to combinations of
PATH, sys.path, and multiple Python installs. Later we can add a warning
here to help guide users to better understanding.
2019-12-19 21:20:51 -05:00
Tzu-ping Chung 204887da03 Apply changes from bundled appdirs to vendored
* Convert Windows app data directory values to bytes on Python 2, so the
  output type is consistent across platforms (pypa/pip#4000)
* Also look in ~/.config for user config on macOS (pypa/pip#4100)
* Remove pywin32 dependency, only use ctypes and winreg for directory
  lookup on Windows (pypa/pip#2467)
* Always use os.path.join() instead of os.sep.join() so cross-platform
  tests work as expected (pypa/pip#3275)
2019-12-19 17:15:03 +08:00
Chris Hunt 82a2651f93 Move pip._internal.main to cli submodule
Moving this out of the way gives us the flexibility to define wrappers
that will redirect requests to our old entrypoints to our new one.
2019-12-18 21:09:22 -05:00
Christopher Hunt ab12706aaa
Merge pull request #7478 from chrahunt/refactor/make-functional-download-tests
Make unpack_* unit tests into functional tests
2019-12-17 07:55:29 +08:00
Stéphane Bidoul (ACSONE) 36ff884673
Fix WheelCache.get in presence of legacy cache keys 2019-12-15 23:43:36 +01:00
Stéphane Bidoul (ACSONE) 80bfba3302
Improve WheelCache.get test 2019-12-15 23:41:03 +01:00
Stéphane Bidoul (ACSONE) 9c74c0214a
Add failing test for legacy cache keys 2019-12-15 23:41:03 +01:00
Christopher Hunt d6491fe666
Merge pull request #7483 from chrahunt/refactor/install-packed-wheel
Add downloaded/local archive path to InstallRequirement
2019-12-15 23:50:36 +08:00
victorvpaulo 81805a5776 Add option to silence warnings related to deprecation of Python versions (#6739)
* Add option to silence warnings related to deprecation of Python versions

* Move skip_if_python2 and skip_if_not_python2 decorator declaratios to test/lib/__init__.py and use them in test_warning.py

* Add tests to ensure that python version deprecation warning is shown correctly and can be silenced by a flag.

* Add new test to ensure that --no-python-version-warning flag does nothing if python version is not 2
2019-12-15 09:59:34 +08:00
Chris Hunt c565d7a1b2 Switch to install_wheel in unit tests
Since it tests install_unpacked_wheel, the coverage should be the same.
2019-12-14 11:38:31 -05:00
Stéphane Bidoul (ACSONE) 32cabbf716
Add test for pip wheel with non-absolute cache dir 2019-12-14 12:47:14 +01:00
Chris Hunt 9faa9aef29 Make download_http_url existing bad file test functional
Reduces coupling between tests and code.
2019-12-13 20:30:45 -05:00
Chris Hunt d3920f299f Make unpack_file_url existing bad file test functional
Reduces coupling between tests and code.
2019-12-13 20:30:45 -05:00
Chris Hunt fe24c7fc16 Make unpack_file_url existing matching file test functional
Reduces coupling between tests and code.
2019-12-13 20:30:45 -05:00
Chris Hunt 30c2d979b0 Make unpack_file_url download test to functional
This and the next several changes will uncouple the tests from the
current implementation, allowing us to factor the actual file download
out of `unpack_file_url` and `unpack_http_url`.
2019-12-13 20:30:45 -05:00
Chris Hunt 50efb55072 Add tests.lib.path.Path.read_bytes
To be used in some upcoming tests.
2019-12-13 20:30:45 -05:00
Pradyun Gedam 8e7a87bf4b
Factor out pep517 wheel build function (#7473) 2019-12-13 04:26:44 +00:00
Christopher Hunt d7eaede434
Revert "Add new option: pip wheel --save-wheel-names (#6377)" (#7420)
This reverts commit bcad1b1cb5, reversing
changes made to f86490317a.

As discussed, we should rethink the interface of this command output as
part of larger CLI usability review. In the interim, the same
functionality can be achieved using straightforward shell commands.
2019-12-13 07:57:05 +08:00
Stéphane Bidoul (ACSONE) 2eff06e7cc
Make WheelBuilder should_unpack argument explicit 2019-12-12 23:46:05 +01:00
Pradyun Gedam ce5edd4841
Better workaround for cache poisoning (#3025, #7319) 2019-12-12 11:28:57 +00:00
Chris Hunt 6343e8093f Replace atexit with globally-managed tempdir 2019-12-09 06:06:37 +08:00
Chris Hunt 0457826bd0 Add global TempDirectory manager
In cases where there is not a clear scope, or where enforcing a scope
and passing a temp directory to callees creates unnecessary coupling
between components, this will let us tie the lifetime of temporary
directories to the lifetime of the application without using e.g.
atexit or finalizers.

This has the benefit of being easier to test and reason about.
2019-12-09 06:06:37 +08:00
Chris Hunt 24d2f1e719 Remove unused arguments 2019-12-05 20:29:43 -05:00
Chris Hunt 7db57478a2 Construct Downloader outside RequirementPreparer
Reduces RequirementPreparer responsibilities, and will let us get rid of
some constructor arguments.
2019-12-05 20:26:53 -05:00
Chris Hunt 762e4a0817 Move parse_content_disposition to network.download 2019-12-04 18:31:53 -05:00
Chris Hunt 32b0fc23ab Move sanitize_content_filename to network.download 2019-12-04 18:31:53 -05:00
Chris Hunt 3fbc991f0c Move _prepare_download to network.download 2019-12-04 18:31:53 -05:00
Chris Hunt db766f3c95 Move helper mock classes to dedicated module
When we factor out tests these will be needed in both sets, and it's
easier to refactor tests later if we avoid creating a dependency between
test files.
2019-12-04 18:30:21 -05:00
Christopher Hunt 830e29e189
Move wheel to operations.install.wheel (#7421)
* Update documentation

For now just fixing the paths and adding a sub-package docstring.
2019-12-04 06:02:39 +08:00
Stéphane Bidoul (ACSONE) 824dca1060
Better support for unicode cache entries 2019-12-02 12:07:19 +01:00
Stéphane Bidoul (ACSONE) 66ba51ca7d
Use legacy cache entries when they exist.
Pip 20 changes the cache key format to include the
interpreter name. To avoid invalidating all existing caches,
we continue using existing cache entries that were computed
with the legacy algorithm. This should not regress issue #3025
because wheel cached in such legacy entries should have
the python implementation tag set.
2019-12-02 12:07:19 +01:00
Stéphane Bidoul (ACSONE) c4ef6163e5
New cache key generation algorithm
Instead of building an URL-ish string that could be
complex to describe and reproduce, generate a dictionary that is
hashed with a simple algorithm.
2019-12-02 12:07:19 +01:00
Stéphane Bidoul (ACSONE) e0165e7b30
Remove unused wheel_builder python_tag argument 2019-12-02 12:07:18 +01:00
Stéphane Bidoul (ACSONE) 178cd3f244
Better workaround for cache poisoning #3025
Make sure ``pip wheel`` never outputs pure python wheels with a
python implementation tag. Better fix/workaround for
`#3025 <https://github.com/pypa/pip/issues/3025>`_ by
using a per-implementation wheel cache instead of caching pure python
wheels with an implementation tag in their name.

Fixes #7296
2019-12-02 12:07:18 +01:00
Chris Hunt b8c16a0dc8 Move Wheel tests 2019-12-02 11:52:51 +08:00
Chris Hunt 60f6ed9387 Move wheel.Wheel to models.wheel.Wheel
This aligns more closely with how the class is used and makes it easier
to move the rest of the wheel module to a dedicated module for
installation.
2019-12-02 11:52:51 +08:00
Chris Hunt bf26185d55 Import Wheel in tests directly 2019-12-02 11:52:51 +08:00
Chris Hunt 1abf978e88 Move format_tag to pep425tags
This is a more appropriate place for the function, since it is more
related to tags than wheels, and will make it easier to refactor Wheel
into its own module.
2019-12-02 11:52:51 +08:00
Chris Hunt b8f626ace6 Deprecate install-location-related options in --install-option 2019-11-30 17:42:48 -05:00
Chris Hunt 55a943e556 Add distutils args helpers
The utils.distutils_args.parse_args function can recognize distutils
arguments so we can deprecate their usage.
2019-11-30 17:39:56 -05:00
Christopher Hunt 5ba702894a
Remove old workaround for Debian Python patch (#7401) 2019-11-26 11:58:46 +08:00
Xavier Fernandez db1a2754bb Fix logging of cached response
Cached responses often (always ?) provide a length meaning they were
never logged as such.
2019-11-25 23:15:00 +01:00
Paul Moore 4f6a965f14
Merge pull request #7394 from takluyver/i6599
Fix building packages with backend-path in pyproject.toml
2019-11-25 21:40:33 +00:00
Xavier Fernandez 95576102c5
Tweak format_size utility function to include a space (#7399) 2019-11-25 22:09:10 +01:00
Xavier Fernandez 8114003e62 Add basic tests for format_size 2019-11-25 14:53:23 +01:00
Chris Hunt 8d38b37052 Ignore WARNING emitted by setuptools during test 2019-11-23 16:17:35 -05:00
Thomas Kluyver 59550aaec3 Add an integration test of installing a project with a local PEP 517 backend 2019-11-23 18:45:09 +00:00
Thomas Kluyver 400cf8d71e Add a test combining local PEP 517 backend with external dependency 2019-11-23 16:57:24 +00:00
Thomas Kluyver edc525add9 Remove leftover debugging code 2019-11-23 16:53:01 +00:00
Thomas Kluyver 81f6ba3fc1 Default None instead of [] 2019-11-23 16:52:24 +00:00
Thomas Kluyver dd7b1ee5c3 Fix building packages with backend-path in pyproject.toml
Closes gh-6599
2019-11-23 14:38:27 +00:00
Christopher Hunt 3ff2513537
Merge pull request #7384 from chrahunt/refactor/cleanup-prepare-3
Cleanup operations.prepare more
2019-11-22 20:52:33 +08:00
Chris Hunt 19806574e5 Move Downloader out of unpack_http_url
Reduces scope of session and progress_bar.
2019-11-21 19:11:46 -05:00
Chris Hunt 4be0a5445a Move Downloader up out of _download_http_url
Reduces exposure of session and progress_bar.
2019-11-21 19:11:46 -05:00
Chris Hunt 1daa8b2fd9 Add mock server wrapper and replace network calls in a test 2019-11-17 17:36:36 -05:00
Chris Hunt bf7ad4a2a1 Remove unnecessary wrapping of tests
The cited issue https://bugs.python.org/issue3210 is fixed in all the
versions of Python that we test against.
2019-11-17 16:12:17 -05:00
Chris Hunt 31f49023bd Add mock_server documentation 2019-11-17 16:12:17 -05:00
Christopher Hunt db4da4737c
Merge pull request #7359 from torsava/master
Mark 6 tests as network tests
2019-11-18 04:15:03 +08:00
Christopher Hunt 4447cb0fae
Merge pull request #7355 from chrahunt/refactor/remove-unnecessary-tag
Remove interpreter-specific major version tag
2019-11-17 07:27:36 +08:00
mdebi f6aaba9fd9 Warn if a path in PATH starts with tilde during install 2019-11-16 00:16:41 +01:00
Xavier Fernandez 9e1b1c7466
Merge pull request #7335 from sbidoul/subdirectory-cache-key-sbi
Include subdirectory URL fragments in cache keys
2019-11-15 23:14:16 +01:00
Tomas Orsava e521228129 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 20:10:01 +01:00
Chris Hunt d4f2c9f962 Remove interpreter-specific major version tag
As mentioned in https://snarky.ca/the-challenges-in-designing-a-library-for-pep-425/
this tag doesn't make much sense + it impedes our usage of
packaging.tags.

In terms of backwards-compatibility, we attest to try to match
compatible wheels as best as possible, and this tag doesn't represent
that.
2019-11-15 00:20:58 -05:00
Christopher Hunt 6bc7a1c5ad
Merge pull request #7342 from chrahunt/refactor/simplify-tags
Make versions argument singular for pep425tags.get_supported()
2019-11-13 10:50:47 +08:00
Chris Hunt 7d27bff299 Make versions argument singular for pep425tags.get_supported()
This simplifies the interface of this function in preparation for
switching to packaging.tags.
2019-11-12 20:58:44 -05:00
Christopher Hunt aaa7de267c
Merge pull request #7344 from chrahunt/refactor/cleanup-prepare
Cleanup operations.prepare
2019-11-13 09:43:51 +08:00
Hanjun Kim 0363420239
update test condition 2019-11-12 20:03:01 +09:00
Stéphane Bidoul (ACSONE) 613cc01c0b
Include subdirectory URL fragment in the cache key 2019-11-12 08:50:21 +01:00
Chris Hunt 95375a5213 Make session a required parameter in operations.prepare 2019-11-11 22:34:52 -05:00
Christopher Hunt 0801e972c3
Merge pull request #7337 from chrahunt/refactor/remove-unneeded-compat
Remove unnecessary native_str implementation
2019-11-11 15:44:02 +08:00
Pradyun Gedam c522381b32
Rename InstallationCandidate.{project -> name} (#7328) 2019-11-11 13:11:19 +05:30
Christopher Hunt 8ce34af430
Merge pull request #7323 from chrahunt/refactor/less-intrusive-pep425tags
Be less intrusive towards pep425tags in tests
2019-11-11 15:37:10 +08:00
Pradyun Gedam 9b25cd512b
Rename InstallationCandidate.{project -> name} 2019-11-11 11:37:53 +05:30
Pradyun Gedam 1405a403fe
Merge branch 'master' into add-use-user-site-to-preparer 2019-11-11 08:40:20 +05:30
Chris Jerdonek f4cad3d403 Add PackageFinder.process_project_url(), and test. 2019-11-10 21:27:13 -05:00
Chris Jerdonek bab1e4f8a1 Change CollectedLinks to store project_urls. 2019-11-10 21:27:00 -05:00
Chris Jerdonek 024038cf10 Add LinkCollector.fetch_page(). 2019-11-10 21:19:07 -05:00
Chris Hunt 0a6305a398 Remove unused compat.native_str 2019-11-10 18:06:24 -05:00
Pradyun Gedam deecb36de9
Reduce RequirementTracker responsibilities (#7278) 2019-11-10 15:08:52 +05:30
Christopher Hunt 2ed5d565de
Merge pull request #7326 from chrahunt/bugfix/enforce-pyproject-requires-format
Enforce requirement format in pyproject.toml build-system.requires
2019-11-10 16:56:18 +08:00
Christopher Hunt 77eb89edbb
Merge pull request #7314 from chrahunt/refactor/remove-req-from-wheel-build
Factor out legacy wheel build function
2019-11-10 16:55:35 +08:00
Pradyun Gedam c9606b86e1
Add use_user_site to RequirementPreparer 2019-11-10 13:51:29 +05:30
Pradyun Gedam 1b07d3e797
Rewrap strings to 80 characters 2019-11-10 12:38:29 +05:30
Pradyun Gedam f39ce3439b
Update tests to correctly enter RequirementTracker context 2019-11-10 12:38:08 +05:30
Pradyun Gedam bb197e12bf
Move make_install_req definition to top of function
Why: Makes the diff for the next commit cleaner
2019-11-10 12:34:59 +05:30
Pradyun Gedam c40a9d332d
Update callsites for RequirementTracker 2019-11-10 12:33:25 +05:30
Chris Hunt f64f15b6d9 Enforce requirement format in build-system.requires 2019-11-09 20:58:27 -05:00
Chris Hunt eb3701f749 Use shared_data to avoid copying the data directory 2019-11-09 20:47:20 -05:00
Chris Hunt 9775387e41 Move unit test to functional test for implicit hash checking 2019-11-09 16:30:44 -05:00
Chris Hunt e4a7276ea0 Explicitly require hashes for tests that expect it
The purpose of these tests is not to check implicit hash-checking mode,
so we can be explicit.
2019-11-09 16:12:05 -05:00
Chris Hunt 7f8c25dbbb Fix call to Resolver/Preparer in tests 2019-11-09 16:11:43 -05:00
Chris Hunt 94dbbe2556 Remove patching of pep425tags internals in wheel tests 2019-11-09 13:09:18 -05:00
Chris Hunt 7f910251a4 Remove unused sys.platform patching from test_wheel 2019-11-09 13:09:06 -05:00
Chris Hunt 8963f63989 Parameterize requirement name for logging 2019-11-08 21:54:03 -05:00
Christopher Hunt 7af704e3cf
Merge pull request #7310 from chrahunt/refactor/scheme
Add Scheme model and use for wheel installation
2019-11-09 09:57:03 +08:00
Chris Hunt e03a71aff8 Use new Scheme model for wheel installation 2019-11-07 12:43:39 -05:00
Pradyun Gedam 0cebc55e3f
Add tests for create_env_error_message function (#7255) 2019-11-07 21:08:02 +05:30
Christopher Hunt d3129f227a
Merge pull request #7301 from chrahunt/refactor/reduce-resolver-finder-dependence
Reduce Resolver dependence on PackageFinder
2019-11-06 14:17:55 +08:00
Pradyun Gedam 7b3d3a31e6
Support PEP 405 include-system-site-packages configuration (#7155) 2019-11-06 11:47:36 +05:30
Christopher Hunt 8341f87046
Merge pull request #7287 from pradyunsg/refactor/simplify-metadata-generation-flow
Simplify metadata generation flow, to be a lot more "linear"
2019-11-06 11:51:49 +08:00
Chris Hunt deac2343dc Don't pass PackageFinder to Preparer from Resolver
Preparer's overall responsibilities align more with having its own
reference to finder, which will help us remove it from resolver later.
2019-11-05 20:57:14 -05:00
Pradyun Gedam 8981895b5e
Skip all failing tests when using venv
Our isolation logic for venv isn't correct and that is causing these
tests to fail. The culprits for this are:

  tests/lib/venv.py::VirtualEnvironment.user_site_packages
  tests/lib/venv.py::VirtualEnvironment.sitecustomize

Both these together are supposed to create an environment to isolate the
tests. However, they were written for virtualenv and make assumptions
that are not true for environments created with venv. Until we can fix
VirtualEnvironment to properly isolate the test from the underlying test
environment when using venv, these tests will continue to fail.

This is blocking an important bugfix for users facing issues with since
pip is installing packages into `--user` when run in a venv, even when
`--user` isn't visible from that environment.

As a temporary band-aid for this problem, I'm skipping these tests to
unblock us from shipping the bugfix for the aforementioned issue.

The test isolation logic should be fixed to work for venv. Once such a
fix is made, this commit should be reverted.
2019-11-05 23:02:45 +05:30
Pradyun Gedam 1aee0eb5cb
Correctly ignore system site-packages for venv
Why: PEP 405 virtual environments have a different mechanism for
ignoring system site-packages in virtual environments.
2019-11-05 14:45:08 +05:30
Pradyun Gedam fd7c9b7ce4
Refactor virtualenv_no_global
Why: This change makes it easier to introduce handling for PEP 405 based
virtual environment's global site-package exclusion logic
2019-11-05 14:45:08 +05:30
Christopher Hunt 7d5967906e
Merge pull request #7288 from pradyunsg/refactor/new-wheel_builder-module
Create a new wheel_builder module and move WheelBuilder+friends
2019-11-05 11:54:09 +08:00
Christopher Hunt 7f8be22584
Merge pull request #7292 from chrahunt/refactor/make-session-required
Make session required in pip._internal.req.req_file functions
2019-11-04 19:40:25 +08:00
Pradyun Gedam 54fc70d212
Stop generating metadata as part of a unit test 2019-11-04 14:30:20 +05:30
Pradyun Gedam b1f2f747f9
🎨 a test 2019-11-04 11:51:44 +05:30
Pradyun Gedam 9435050c2d
Move tests for WheelBuilder and friends 2019-11-04 11:51:44 +05:30
Pradyun Gedam 647d30ec77
Move hash_file to utils.misc
Why: Allows for better code reuse, without introducing dependency
between wheel->wheel_builder.
2019-11-04 11:51:08 +05:30
Pradyun Gedam da9a432576
Move WheelBuilder and friends to a dedicated module 2019-11-04 11:49:02 +05:30
Chris Hunt df42c80ff6 Make session required in pip._internal.req.req_file functions 2019-11-03 20:49:11 -05:00
Christopher Hunt e79fa0e8a2
Merge pull request #6851 from sbidoul/pip6640-sbi
Cache wheels built from immutable VCS requirements
2019-11-04 08:32:11 +08:00
Christopher Hunt 5b77910715
Merge pull request #7289 from chrahunt/bugfix/send-client-cert
Send client certificate when using --trusted-host
2019-11-04 08:30:28 +08:00
Chris Hunt d9854794fa Add failing test for missing client cert when using --trusted-host 2019-11-03 17:05:58 -05:00
Chris Hunt 204a004377 Add test helpers for HTTP(S) server and certs 2019-11-03 17:05:52 -05:00
Stéphane Bidoul (ACSONE) 9cad519521
Cache wheels built from immutable Git requirements
Cache wheels that are built from Git requirements
that contain an immutable revision (i.e. a sha).
2019-11-03 22:54:33 +01:00
Stéphane Bidoul (ACSONE) f5eba4f726
Add tests for git sha wheel caching 2019-11-03 22:54:33 +01:00
Christopher Hunt 44c8caccd4
Merge pull request #7285 from sbidoul/pip-wheel-cache-like-pip-install-sbi
Make pip wheel cache what it built
2019-11-04 05:49:35 +08:00
Stéphane Bidoul (ACSONE) ba60397dd4
Make pip wheel cache what it built
Just like pip install.
2019-11-03 22:08:42 +01:00
Chris Hunt 3076c39f25 Remove unused Resolver.session 2019-11-03 14:31:38 -05:00
Chris Hunt 44cc3aeb0a Use session from RequirePreparer, not Resolver 2019-11-03 14:26:47 -05:00
Christopher Hunt 39d16b6ca8
Merge pull request #7276 from chrahunt/refactor/shared-test-scripts
Share script fixtures across tests
2019-11-02 23:45:48 +08:00
Stéphane Bidoul (ACSONE) 18a58815a1
Refactor _get_used_vcs_backend 2019-11-01 12:53:54 +01:00
Christopher Hunt 2a2794e09b
Merge pull request #7268 from sbidoul/remove-should_use_ephem_cache-sbi
remove should_use_ephemeral_cache
2019-11-01 16:29:03 +08:00
Christopher Hunt a0fd8c2154
Merge pull request #7261 from chrahunt/refactor/simplify-req-file-parsing-3
Simplify requirement file parsing
2019-10-31 09:20:40 +08:00
Chris Hunt 0c4625b2ba Use another shared script in pip list tests 2019-10-30 02:16:23 -04:00
Chris Hunt 6cd9852626 Use shared script in pip list tests 2019-10-30 01:55:32 -04:00
Chris Hunt 1f9028851d Make shared script with launchers installed 2019-10-30 01:54:57 -04:00
Chris Hunt ab6b17b2a6 Refactor autocomplete test helper to use shared script 2019-10-30 01:53:48 -04:00
Chris Hunt cc73b2b933 Use shared autocomplete_script for tests 2019-10-30 01:53:45 -04:00
Chris Hunt ae4ad85e5f Make virtualenv/script fixture factories 2019-10-29 23:41:34 -04:00
jenix21 d8567d3b66 address review comment 2019-10-30 00:33:15 +09:00
Stéphane Bidoul (ACSONE) cdf09bfc4a
remove should_use_ephemeral_cache 2019-10-29 09:15:44 +01:00
Stéphane Bidoul (ACSONE) aaa4237adf
refactor should_use_ephemeral_cache 2019-10-28 22:56:04 +01:00
Pradyun Gedam be13cf95d2
Merge pull request #7258 from takluyver/use-user-site-int
Allow for use_user_site being set to an integer
2019-10-27 19:15:04 +05:30
Thomas Kluyver f92efc022b Test that setting user in the config file works 2019-10-27 10:09:15 +00:00
Chris Hunt 85918afc5e Remove req_file.process_line and update tests
The behavior that was in process_line was moved to
RequirementsFileParser so it's no longer needed, we just had to
move the remaining tests to use the higher-level parse_requirements
interface.
2019-10-26 13:53:01 -04:00
Chris Hunt 68454d29a5 Make req file parsing unit tests higher-level
Decoupling the tests from the implementation makes it possible
to refactor the interface exposed by process_line.
2019-10-26 13:52:36 -04:00
Christopher Hunt be01170ba5
Merge pull request #7245 from chrahunt/refactor/simplify-req-file-parsing-2
Simplify requirement file parsing
2019-10-25 19:51:04 +08:00
jenix21 4c6052d2d6 Add tests for create_env_error_message function 2019-10-23 01:00:08 +09:00
Pradyun Gedam c729a84b48
Merge pull request #7002 from takluyver/install-user-fallback
Default to --user install in certain conditions
2019-10-22 08:44:06 +05:30
Thomas Kluyver c4d92bbb4e Use pytest parametrize for decide_user_install tests 2019-10-21 08:52:44 +01:00
Thomas Kluyver fbc0588c01 Add unit tests of decide_user_install() 2019-10-20 21:48:18 +01:00
Chris Hunt a5d53eab0a Simplify skip_requirements_regex option handling
Decouples `process_lines` from our CLI options.
2019-10-20 13:33:15 -04:00
Pradyun Gedam 8dbf8461fc
Clean up wheel.move_wheel_files (#7176) 2019-10-20 13:26:48 +05:30
Pradyun Gedam 9ab9040d75
Remove RequirementSet.require_hashes (#7068) 2019-10-20 13:23:40 +05:30
Pradyun Gedam 611fc6069b
Update references to collector.py 2019-10-19 22:24:53 +05:30
Pradyun Gedam 2db6f428bf
Update imports to {index -> index.package_finder} 2019-10-19 22:24:01 +05:30
Pradyun Gedam 66e9b44f15
Import req_file more directly 2019-10-19 22:22:11 +05:30
Pradyun Gedam c18e912b2a
Import InstallationCandidate more directly 2019-10-19 22:22:11 +05:30
Pradyun Gedam bcad1b1cb5
Add new option: pip wheel --save-wheel-names (#6377) 2019-10-19 11:03:15 +05:30
Pradyun Gedam 053346f3b0
Merge pull request #7187 from chrahunt/refactor/move-get-file-content
Remove pip._internal.download
2019-10-18 06:47:07 +05:30
Christopher Hunt 24c9daaaa9
Merge pull request #6857 from abs51295/fix-pip-freeze
Canonicalize FrozenRequirement name for correct comparison
2019-10-17 20:08:23 -04:00
Pradyun Gedam 2e9f89ef8f
Fix PEP 517 builds for packages without setup.py (#6606) 2019-10-17 22:18:03 +05:30
Christopher Hunt 7c755a571d
Merge pull request #7216 from NeilBotelho/debug-ca-info
Display CA information in pip debug
2019-10-17 04:29:41 -04:00