1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
Commit graph

3337 commits

Author SHA1 Message Date
Pradyun Gedam e51a027964
Merge pull request #8659 from uranusjr/fix-get-distribution-dot-in-name
Canonicalize name in check_if_exists
2020-08-02 07:44:24 +05:30
Nguyễn Gia Phong 0ef877339a Make assertions independent of log prefixes 2020-08-01 20:26:44 +07:00
Tzu-ping Chung ea47920767 Add test case for SlikSVN version parsing 2020-08-01 02:03:45 +08:00
Tzu-ping Chung 1fd5098b24 Canonicalize name in check_if_exists
The previous implementation uses pkg_resources.get_distribution(), which
does not canonicalize the package name correctly, and fails when
combined with pip's own get_distribution(), which does canonicalize
names. This makes InstallRequirement.check_if_exists() only use pip's
own canonicalization logic so different package name forms are matched
as expected.
2020-07-30 22:04:51 +08:00
Chris Hunt 3f9b326c11 Provide a reasonable error on invalid scheme keys
Originally we would throw an `AttributeError` if a bad scheme key was
used. After refactoring we would throw a `KeyError`, which isn't much
better. Now we call out the wheel being processed, scheme key we didn't
recognize, and provide a list of the valid scheme keys. This would
likely be useful for people developing/testing the wheel.
2020-07-29 22:24:09 -04:00
Chris Hunt 864f0e0efa Explicitly handle incorrect .data paths during wheel install
Previously our wheel installation process allowed wheels which contained
non-conforming contents in a contained .data directory.

After the refactoring to enable direct-from-wheel installation, pip
throws an exception when encountering these wheels, but does not include
any helpful information to pinpoint the cause.

Now if we encounter such a wheel, we trace an error that includes the
name of the requirement we're trying to install, the path to the wheel
file, the path we didn't understand, and a hint about what we expect.
2020-07-29 18:12:16 -04:00
Pradyun Gedam a8edffda1c
Merge pull request #8594 from pradyunsg/improve-install-conflict-warning 2020-07-28 18:22:53 +05:30
Nguyễn Gia Phong a85be3f555 Test verbose/quiet level specified via env var and config file 2020-07-28 10:13:24 +07:00
Pradyun Gedam 3f88476e4f
This counts as a fix right? 2020-07-27 20:06:55 +05:30
Pradyun Gedam 3962f9d2b8
Moar tests getting updated 2020-07-27 19:51:47 +05:30
Pradyun Gedam b9ff93f7ba
Update test messages to reflect new reality 2020-07-27 19:51:47 +05:30
Pradyun Gedam c631de61b9
Drop no-longer-used deprecated_python fixture 2020-07-27 19:51:47 +05:30
Pradyun Gedam e4f8e0a2b8
Change {matches -> contains}_expected_lines
This also updates invocations that can't be translated as-is into a
different equivalent check.
2020-07-27 19:51:47 +05:30
Pradyun Gedam a89ede7da3
tests: Check only the last output lines 2020-07-27 19:51:47 +05:30
Pradyun Gedam 43da7c8283
Make the YAML tests happier 2020-07-27 13:49:21 +05:30
Pradyun Gedam 7056132f6f
Merge pull request #8601 from rouge8/use-feature-requirements-file 2020-07-27 13:19:51 +05:30
Tzu-ping Chung 906072a292 Test for conflict message from requirements.txt 2020-07-26 15:59:07 +08:00
Nguyễn Gia Phong 5b1093fc75 Use monkeypatch.*env in conftest and tests.lib
Session fixtures have to use mock.patch.dict though
2020-07-25 20:46:45 +07:00
Nguyễn Gia Phong c564a3d541 Use monkeypatch.setenv in config and option tests 2020-07-25 20:46:45 +07:00
Stéphane Bidoul ccdfa74d79
Reduce reliance on .egg-info directories in test suite
Make more tests run with with_wheel and test
that a .dist-info directory is created.
2020-07-25 13:02:20 +02:00
Stéphane Bidoul 38fe3c2f14
Percolate --use-feature from req file upwards
We explicitly propagate --use-feature options from req files upwards.
This is not strictly necessary for the option to be enabled, because
of the default value is a global list, but that implicit behaviour is
certainly accidental, so we make it explicit, with a test.
2020-07-25 11:14:04 +02:00
Pradyun Gedam 89a51a6fef
Merge pull request #8588 from McSinyx/fast-deps
Use lazy wheel to obtain dep info for new resolver
2020-07-24 09:01:56 +05:30
Pradyun Gedam f94580bad7
Print output in test_debug__library_versions
This should make debugging issues in this test easier.
2020-07-22 19:57:20 +05:30
Nguyễn Gia Phong 4efae5c21a Add integration tests for experimental feature fast-deps
Test pip {download,install,wheel} where requirements have dependencies
listed in their wheels' metadata.
2020-07-21 16:00:34 +07:00
Pradyun Gedam 982aac544e
Merge pull request #8584 from McSinyx/range-unsupported-exc 2020-07-21 13:53:20 +05:30
Andy Freeland 7a3c802626 Attempt to test --use-feature in pip freeze
I can't get the functional tests to run locally...
2020-07-19 02:44:12 -07:00
Andy Freeland 3eef588a03 Support '--use-feature' in requirements files
This patch adds support for `--use-feature` in requirements files
so that a project that wants all contributors using the same pip
features can specify it in the requirements file. For example, to ensure
a requirements file uses the new resolver:

```
--use-feature=2020-resolver
boto3
boto3==1.13.13
```

This is a new version of #8293.
2020-07-18 16:08:47 -07:00
Nguyễn Gia Phong d363b4a427 Replace tabs by spaces for consistency 2020-07-18 17:00:59 +07:00
Nguyễn Gia Phong 05bdc69aa3 Make test more explicit 2020-07-17 14:33:19 +07:00
Nguyễn Gia Phong cb8d81d135 Nitpick logging calls 2020-07-17 14:33:19 +07:00
Nguyễn Gia Phong 892018eaf2 Use local server for an unit test for lazy wheel 2020-07-16 21:09:59 +07:00
Chris Hunt c40d7b2122
Merge pull request #8575 from chrahunt/tests/add-better-entrypoint-test
Make wheel entrypoint error test higher-level
2020-07-15 16:52:35 -04:00
Pradyun Gedam fa2fceecf1
Merge pull request #8189 from gutsytechster/remove_raise_for_status 2020-07-15 18:06:27 +05:30
Pradyun Gedam 61d497120f
Merge pull request #8424 from jku/8288-deprecate-nonconforming-extras 2020-07-15 18:03:00 +05:30
Nguyễn Gia Phong db217992bd Use more descriptive exception when range requests are unsupported 2020-07-15 16:28:53 +07:00
Chris Hunt 607ec6c342
Merge pull request #7416 from chrahunt/maint/add-coverage
Add basic test coverage configuration
2020-07-14 19:22:56 -04:00
Chris Hunt 328e4c06da
Merge pull request #8502 from uranusjr/new-resolver-binary-compat-on-target
Ensure binary compat is checked in --target
2020-07-13 20:38:13 -04:00
Jussi Kukkonen 76b20d738e Deprecate requirements format "base>=1.0[extra]"
This requirements format does not conform to PEP-508. Currently the
extras specified like this work by accident (because _strip_extras()
also parses them). The version checks end up being done with a
misparsed version '1.0[extra]' -- this is not changed in this commit.

Add deprecation warning and fix the corresponding resolver test. Add a
command line test.

Note that we really only check that the Requirement has SpecifierSet
with a specifier that ends in a ']'. A valid version number cannot
contain ']' and no wheels currently on pypi have versions ending in ']'.
2020-07-13 12:33:50 +03:00
Chris Hunt 05f2d9ebf6 Make entrypoint error test higher-level
The current tests didn't catch the bug that the new tests do,
so they have been removed. Using higher-level tests can give us more
confidence that things work end-to-end and are less likely to get in
the way of refactoring.

The new test has been marked xfail since the bug is still present.
2020-07-11 15:45:18 -04:00
Chris Hunt 8bf5731b84
Merge pull request #8562 from chrahunt/extract-direct-from-zip-refactoring
Install directly from wheels, without unpacking into an intermediate directory
2020-07-10 21:33:16 -04:00
Chris Hunt 15b7afbcad
Merge pull request #8266 from gutsytechster/add_logs_for_install
feat(): Add logs for pip environment when installing
2020-07-10 09:36:13 -04:00
Prashant Sharma f7abe1f874
test(functional/test_install): Use shared_data for installing package 2020-07-10 16:20:30 +05:30
Chris Hunt e9508591ce
Merge pull request #8556 from chrahunt/maint/fail-on-install-location-options
Disallow explicitly passing install-location-related arguments in --install-options
2020-07-09 21:25:20 -04:00
Chris Hunt d13ec25361 Prevent path traversal when installing wheels directly 2020-07-09 21:21:35 -04:00
Tzu-ping Chung 152642ddcf Ensure binary compat is checked in --target 2020-07-09 21:23:21 +08:00
gutsytechster 0ccbad8367
feat(): Add logs for pip environment when installing 2020-07-09 18:15:43 +05:30
Prashant Sharma 07e8712677
reformat(pip/_internal): Resolve lint errors 2020-07-09 15:15:01 +05:30
Christopher Hunt 2f9b50c097
Merge pull request #8534 from chrahunt/thoroughly-test-header-installation
Make wheel header installation test more explicit
2020-07-08 17:21:47 -04:00
Christopher Hunt 5da104af71
Merge pull request #8547 from chrahunt/test-record-population
Test RECORD population for data files
2020-07-08 08:52:42 -04:00
gutsytechster 8c267e6e39
feat(pip/_internal/*): Use custom raise_for_status method 2020-07-08 18:08:55 +05:30
Chris Hunt cb540f30e3 Add basic test coverage configuration
This handles:

* Sub-processes within unit tests (thanks pytest-cov)
* Our pytest-fixture-based virtual environments and subprocesses
  therein
* Running with xdist (e.g. `-n auto`)
* Combining results from all of the above using paths rooted with
  `src/pip/*`

This doesn't handle:

* Platform-specific branches
* Python 2
* CI integration
2020-07-07 21:58:55 -04:00
Christopher Hunt b27956928f
Merge pull request #8553 from uranusjr/header-location-prefix
Header location prefix
2020-07-07 21:37:50 -04:00
Christopher Hunt 53aa1a932b
Merge pull request #8538 from McSinyx/parallel-test-teardown
Make utils.parallel tests tear down properly
2020-07-07 21:19:28 -04:00
Chris Hunt f878fcdeec Rename function that reject location install options
Since it no longer shows a deprecation warning, the previous name
doesn't fit.
2020-07-07 19:11:11 -04:00
Chris Hunt 89572a7d40 Throw CommandError on any location-related install options 2020-07-07 19:11:11 -04:00
Chris Hunt b46d8ab01a Refactor overriding test to not use disallowed option
Similar to our previous test refactoring, this removes the usage of
`--home` from the test command.

"Overriding" in the original test meant "placed after" in the
command-line arguments, which makes sense because setuptools will use
the last argument passed.
2020-07-07 19:11:02 -04:00
Chris Hunt 50d7b930d3 Create more robust test for isolated --install-option
The current test depends on passing `--home` to `--install-option`.
Since we would like that to fail, we need to use another argument. None
of the other possible arguments have a visible side-effect, so we just
write the provided arguments to a file and check that in the test.
2020-07-07 19:10:27 -04:00
Chris Hunt ffddab6986 Test that RECORD is populated correctly for data files 2020-07-07 09:25:16 -04:00
Chris Hunt a365764e57 Add test for RECORD population by make_wheel 2020-07-07 09:25:16 -04:00
Tzu-ping Chung 600d5272e6 Add failing test for --prefix location 2020-07-07 18:53:33 +08:00
Christopher Hunt 334f06e224
Merge pull request #8054 from deveshks/correct-package-name-while-install
Canonicalize req name while doing pre-install package search
2020-07-06 12:10:33 -04:00
Christopher Hunt 161ee7f852
Merge pull request #8548 from chrahunt/better-wheel-empty-dir-test
Refactor test for empty directory in wheel
2020-07-06 09:25:31 -04:00
Devesh Kumar Singh 04fedfe53c Create custom get_distribution function 2020-07-06 13:42:05 +05:30
Devesh Kumar Singh 2bdec6c9fd Parametrize unit test 2020-07-06 13:32:09 +05:30
Devesh Kumar Singh 40261a475f Add unit tests to verify pkg name normalization 2020-07-06 13:32:09 +05:30
Tzu-ping Chung 01e0700e68 Skip installing if the version matches locally
This check only applies to explicit requirements since we avoid
downloading the dist from finder altogether when there is a matching
installation (although the check wouldn’t change the behaviour in that
case anyway).

We can do this when we build the `ExplicitRequirement` instead, like how
we did for `SpecifierRequirement`, but that would require us to resolve
the direct requirement’s version eagerly, which I don’t want to.

The implemented approach checks the version only after resolution, at
which point the distribution is already built anyway and the operation
is cheap.
2020-07-06 11:06:14 +08:00
Christopher Hunt 4ba51d2e9c
Merge pull request #8501 from uranusjr/refactor-create-link-collector
Tidy up link collector constructor imports
2020-07-05 21:44:31 -04:00
Chris Hunt ba96ba3b08 Reduce empty directory test coupling to implementation
Our previous test required that the implementation use a temporary
directory and unpack the wheel in-place. Now we just provide a
conventional empty directory in the wheel file itself.
2020-07-05 20:16:36 -04:00
Chris Hunt a9c7f229b0 Create sample project wheel inline 2020-07-05 20:16:36 -04:00
Christopher Hunt 1f8a4dde26
Merge pull request #8541 from chrahunt/refactor/compile-file-next-steps
Byte-compile files after installation
2020-07-05 12:56:39 -04:00
Chris Hunt 42c01ae97e Normalize Path to str in wheel tests
In our next commit we will use the scheme path to locate files to
byte-compile. If the scheme path is a `Path`, then that causes
`compileall.compile_file` (via `py_compile.compile`) to fail with:

```
.tox/py38/lib/python3.8/site-packages/pip/_internal/operations/install/wheel.py:615: in install_unpacked_wheel
    success = compileall.compile_file(
../../../.pyenv/versions/3.8.0/lib/python3.8/compileall.py:157: in compile_file
    ok = py_compile.compile(fullname, cfile, dfile, True,
../../../.pyenv/versions/3.8.0/lib/python3.8/py_compile.py:162: in compile
    bytecode = importlib._bootstrap_external._code_to_timestamp_pyc(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

code = <code object <module> at 0x7fa7e274f500, file "/tmp/user/1000/pytest-of-chris/pytest-37/test_std_install_with_direct_u0/dest/lib/sample/__init__.py", line 1>, mtime = 1593910285.2200587, source_size = 134

>   ???
E   ValueError: unmarshallable object
```

Debugging in gdb shows that the error is set due to the `Path` object
being present in the code object, which `marshal.dumps` can't handle
(frame 1):

```
 0  w_complex_object (v=<optimized out>, flag=<optimized out>, p=0x7fffffff7160) at Python/marshal.c:564
 1  w_object (v=<Path at remote 0x7fffee51f120>, p=0x7fffffff7160) at Python/marshal.c:370
 2  w_complex_object (v=<code at remote 0x7fffee591710>, flag=<optimized out>, p=0x7fffffff7160) at Python/marshal.c:544
 3  w_object (v=<code at remote 0x7fffee591710>, p=0x7fffffff7160) at Python/marshal.c:370
 4  w_complex_object (v=('1.2.0', <code at remote 0x7fffee591710>, 'main', None), flag=<optimized out>, p=0x7fffffff7160) at Python/marshal.c:475
 5  w_object (v=('1.2.0', <code at remote 0x7fffee591710>, 'main', None), p=0x7fffffff7160) at Python/marshal.c:370
 6  w_complex_object (v=<code at remote 0x7fffee591ea0>, flag=<optimized out>, p=0x7fffffff7160) at Python/marshal.c:539
 7  w_object (p=0x7fffffff7160, v=<code at remote 0x7fffee591ea0>) at Python/marshal.c:370
 8  PyMarshal_WriteObjectToString (version=<optimized out>, x=<code at remote 0x7fffee591ea0>) at Python/marshal.c:1598
 9  marshal_dumps_impl (module=<optimized out>, version=<optimized out>, value=<code at remote 0x7fffee591ea0>) at Python/marshal.c:1739
 10 marshal_dumps (module=<optimized out>, args=<optimized out>, nargs=<optimized out>) at Python/clinic/marshal.c.h:124
```

In the interest of easy git bisects, we commit this fix before the code
that would expose the bug.
2020-07-05 09:38:08 -04:00
Pradyun Gedam 8db4fc8224
Merge pull request #8530 from pradyunsg/rollout-flags 2020-07-05 01:50:25 +05:30
Pradyun Gedam 107ec292c2
Merge pull request #8539 from pradyunsg/warn-on-unsupported-use-of-constraints 2020-07-05 01:48:54 +05:30
Pradyun Gedam 28592d4c31
Allow for the deprecation warning in tests 2020-07-05 01:01:02 +05:30
Chris Hunt b5f02f9dd8 Check that expected text is written in include files
This is a little more specific than checking that we happened to create
an already-empty file, and is a better mirror for reality.
2020-07-04 14:23:10 -04:00
Chris Hunt 0b0d53e8fa Use wheel helper function instead of pre-created wheel file 2020-07-04 14:22:15 -04:00
Chris Hunt 00191b2db1 Explicitly test that header file was created as-expected
Since this is the special part of this test. This gives us more
confidence that we're doing the right thing when removing the standalone
wheel file next.
2020-07-04 14:22:15 -04:00
Nguyễn Gia Phong 512221e1c1 Make utils.parallel tests tear down properly 2020-07-04 15:07:38 +07:00
Chris Hunt 3930e4b063 Drop unused argument 2020-07-03 19:46:45 -04:00
Chris Hunt d49d97f19f Pass Wheel distribution to install.wheel.get_entrypoints
Right now we're just wiring up the arguments. Next we will actually use
them.
2020-07-03 19:46:45 -04:00
Chris Hunt a953787152 Extract entrypoint test text construction into variable
We need this to construct the new argument to `get_entrypoints`.
2020-07-03 19:46:45 -04:00
Chris Hunt 3fad029b77 Test get_entrypoints when none are expected 2020-07-03 17:49:56 -04:00
Chris Hunt dcd5cadcfd Expect a plain list in get_csv_rows_for_installed
This makes get_csv_rows_for_installed simpler, because it is not
modifying its arguments. We can also more easily refactor RECORD file
reading since it is now decoupled from getting the installed RECORD file
rows.
2020-07-03 12:25:12 -04:00
Pradyun Gedam 49b793cd03
Set correct envvar for new-resolver tests 2020-07-03 20:11:36 +05:30
Pradyun Gedam 79de2c8911
Switch to --use-feature for determining which resolver to use
Also changes all invocations in the tests, to the new flag.
2020-07-03 18:49:56 +05:30
Christopher Hunt 4645ecbdb0
Merge pull request #8447 from jku/use-valid-signals-on-py38
test server: Don't mask invalid signals on py38
2020-07-02 12:03:11 -04:00
Jussi Kukkonen 23ec070cf1
test server: use set of signals
This is what signal.pthread_sigmask() really wants and matches signal.valid_signals() output

Co-authored-by: Christopher Hunt <chrahunt@gmail.com>
2020-07-02 18:00:29 +03:00
Xavier Fernandez 09f9b0030d
Merge pull request #8096 from deveshks/list-config-files
Add option to list config files with pip config
2020-07-02 15:01:35 +02:00
Pradyun Gedam e774eccf46
Merge pull request #8343 from uranusjr/entrypoint-unicode 2020-06-30 14:33:24 +00:00
Pradyun Gedam 18431be48f
Merge pull request #8467 from McSinyx/lazy-wheel 2020-06-30 13:39:04 +00:00
Pradyun Gedam 93b0683d65
Merge pull request #8470 from deveshks/remove-always-unzip 2020-06-30 13:33:30 +00:00
Pradyun Gedam 17608c43d1
Merge pull request #8465 from deveshks/collector-debug-to-warn 2020-06-29 18:28:10 +00:00
Devesh Kumar Singh 6c899ed0c8 Update warning message to specify HTTP request 2020-06-29 22:20:11 +05:30
Pradyun Gedam 3a22663ab2
Merge pull request #8320 from McSinyx/pools 2020-06-29 07:54:14 +00:00
Devesh Kumar Singh 46790a4f3c Improve warning message for invalid vcs schemes 2020-06-28 16:23:07 +05:30
Devesh Kumar Singh 499e112275 Add unit tests to check vcs and archive url with invalid scheme 2020-06-28 16:23:07 +05:30
Devesh Kumar Singh 056f119ca9 Add test to verify global config file path 2020-06-28 16:22:01 +05:30
Devesh Kumar Singh 6e62481568 Add unit tests for pip config debug 2020-06-28 16:22:01 +05:30
Devesh Kumar Singh 7a8f374c39 Add option to list config files with pip config 2020-06-28 16:22:00 +05:30
Xavier Fernandez 9a3c082070
Merge pull request #8182 from deveshks/no-input-tests
Enable --no-input option by adding docs and tests
2020-06-26 21:29:19 +02:00