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

1707 commits

Author SHA1 Message Date
Miro Hrončok fe7948a4a2 Avoid distutils imports in tests
The tests still don't run without distutils
because they require virtualenv < 20 (and virtualenv 16 uses distutils),
but at least they don't import distutils directly now.

Fixes https://github.com/pypa/pip/issues/11521
2022-10-17 19:33:03 +02:00
Paul Moore f86f52c1b7 Get rid of the timeout test as it's too flaky to be useful 2022-10-07 20:52:35 +01:00
Pradyun Gedam 7311c82476
Merge pull request #11359 from sbidoul/deprecate-install-options
Deprecate --install-options
2022-10-06 10:06:48 +01:00
Felipe Peter e6e7c12b6d
Disallow freeze format with pip list --outdated (#11482)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
2022-10-04 10:11:46 +01:00
Stéphane Bidoul 51c78b4b83
Add tests for --xxx-options warnings and deprecation 2022-09-25 11:21:36 +02:00
Min RK 24773bc4f5
Fix build isolation on system Pythons
use site.getsitepackages() where available
instead of just purelib/platlib,
which is often insufficient on e.g. System Pythons for Debian/macOS

handle virtualenv < 20 overwriting site.py without getsitepackages() by preserving current behavior.
2022-09-23 14:47:41 +02:00
Danny McClanahan bad03ef931
Use data-dist-info-metadata (PEP 658) to decouple resolution from downloading (#11111)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
2022-09-10 11:28:57 +01:00
Tzu-ping Chung 8856b5900e Further attempt to stablize timeout test 2022-09-08 10:24:04 +08:00
Tzu-ping Chung bfbe919fd2
Merge pull request #11277 from vanschelven/respect-no-index-from-requirements-file 2022-08-30 15:47:51 +08:00
Tzu-ping Chung 5ec3f37bc8 Don't retry to 'improve' possibility of failure 2022-08-17 15:38:15 +08:00
Tzu-ping Chung 26b66a830f Decrease timeout to make test less flaky 2022-08-17 06:41:27 +08:00
Stéphane Bidoul be718ff59e
Fix tests that relied on setuptools not supporting PEP 660 2022-08-12 12:57:39 +02:00
Stéphane Bidoul ee7bcae0d9
Merge pull request #11331 from sbidoul/8559-take-2-sbi
Deprecate setup.py install fallback when wheel package is absent
2022-08-10 18:43:25 +02:00
Stéphane Bidoul 496bf56542
Merge pull request #10416 from sbidoul/test-indented-warnings-sbi
Detect indented ERROR and WARNING messages in tests and ignore own deprecation warnings
2022-08-10 18:42:49 +02:00
Stéphane Bidoul afe136c42b
Add test for issue 8559 deprecation 2022-08-06 19:29:31 +02:00
Stéphane Bidoul 0326b33a6d
Add missing with_wheel fixture 2022-08-06 19:29:31 +02:00
Stéphane Bidoul 1800635e4c
Fix tests with indented errors and warning 2022-08-05 09:35:00 +02:00
Paul Moore 0d6fadac6c Merge branch 'main' into python_option 2022-08-01 09:43:55 +01:00
Paul Moore b5afdd6048 Fix test to cater for packages leaked into venv 2022-07-30 16:37:58 +01:00
Paul Moore 01e122ed41 Add tests 2022-07-30 16:12:42 +01:00
Paul Moore ee6c7caabd Fix test_runner_work_in_environments_with_no_pip to work under --use-zipapp 2022-07-28 11:57:26 +01:00
Paul Moore 662f940c96 Merge branch 'main' into test_zipapp 2022-07-28 10:51:04 +01:00
Klaas van Schelven 80c3b9615f Textual: "locally built" rather than "built"
As per @sbidoul's remark
2022-07-26 08:16:49 +02:00
Klaas van Schelven d57c5dd1ee Fixed the tests 2022-07-25 15:11:54 +02:00
Stéphane Bidoul 3f5436cf3d
Use installer instead of setuptools in test suite
Instead of using a private setuptools api to
install common wheels in "editable" mode,
use 'installer' together with a .pth.
2022-07-23 16:22:02 +02:00
Klaas van Schelven 5d7a1a68c7 Respect --no-index from the requirements file
See #11276

SearchScope was extended with an extra parameter to be able to pass-on the
value of no_index as we do with the other parameters. This allows us to respect
its value regardless of the order in which options are evaluated.
2022-07-20 15:55:17 +02:00
Stéphane Bidoul a7a35dc20d
Merge pull request #11245 from sbidoul/pip-inspect-sbi
Add pip inspect command
2022-07-18 08:10:07 +02:00
Stéphane Bidoul 909be0d786
Merge pull request #11259 from sbidoul/drop-html5lib
Drop html5lib
2022-07-16 20:04:49 +02:00
Stéphane Bidoul 6d02fe2410
Merge pull request #11262 from pradyunsg/reuse-environment-runner-sccript
Move `__pip-runner__` script into a module
2022-07-16 19:50:03 +02:00
Stéphane Bidoul bb2a3d7410
Remove the html5lib deprecated feature flag. 2022-07-16 19:37:11 +02:00
Stéphane Bidoul a7df613b78
inspect: add experimental status warning 2022-07-15 14:08:38 +02:00
Stéphane Bidoul 585136494e
Add pip inspect command 2022-07-15 14:08:38 +02:00
Pradyun Gedam 470b217e8c
Add a test that the runner script works in environments without pip
This ensures that the runner script can be used in environments where
pip is not installed.
2022-07-15 12:22:08 +01:00
Stéphane Bidoul d830c96403
Merge pull request #10771 from sbidoul/install-report-sbi
Installation/resolution report (aka pip install --dry-run --report)
2022-07-15 12:29:06 +02:00
Stéphane Bidoul 074c6b5cad
install report: added experimental status warning 2022-07-15 11:08:56 +02:00
Stéphane Bidoul e41b13424e
install report: use array instead of dict for install field 2022-07-15 11:08:56 +02:00
Tzu-ping Chung 534262d1d6
Merge pull request #11241 from pradyunsg/drop-backtrack-on-build-failures 2022-07-15 16:34:10 +08:00
Pradyun Gedam 8bebea801d
Remove --use-deprecated=backtrack-on-build-failures
This flag is due for removal, in pip 22.2.
2022-07-15 08:27:23 +01:00
Paul Moore ea2318fbf9 Minor zipapp-related fixes and skips for some tests 2022-07-12 10:12:17 +01:00
Stéphane Bidoul 99818e1e9a
Merge pull request #10692 from t20100/fix-install-pre
Fix `pip install --pre` for packages with dependencies defined in `pyproject.toml` and `setup.py`
2022-07-10 13:17:57 +02:00
Stéphane Bidoul 7fdff17543
install report: add suport for stdout output 2022-07-05 10:05:57 +02:00
Stéphane Bidoul d32a62b3df
Use canonical names as keys in installation report 2022-07-05 10:05:57 +02:00
Stéphane Bidoul 2c84a1c16d
Add requested_extras to installation report 2022-07-05 10:05:57 +02:00
Stéphane Bidoul d6685d09cf
Test that the install report has requires_dist
This is important for legacy setuptools distributions that do not
have Requires-Dist in PKG-INFO.
2022-07-05 10:05:57 +02:00
Stéphane Bidoul e37178775b
Add --report option to pip install 2022-07-05 10:05:57 +02:00
Stéphane Bidoul 340054a6bd
Merge pull request #11052 from SpecLad/fix-script-record-hash
Update the RECORD entry when rewriting the shebang line in a script
2022-06-26 12:20:13 +02:00
Stéphane Bidoul 65680b4bb1
Merge pull request #11096 from sbidoul/install-dry-run-sbi
Add --dry-run option to pip install
2022-06-26 11:41:48 +02:00
Роман Донченко e4cd6da6e5 Update the RECORD entry when rewriting the shebang line in a script
The code to do this already exists in `get_csv_rows_for_installed`, but it's
broken due to inconsistent usage of the `_fs_to_record_path` function. When
we build the dictionary of installed files, we call it with a base
directory, while when build the set of modified files, we call it without a
base directory. As a result, the values of `installed` do not match the
elements of `changed`, and `get_csv_rows_for_installed` fails to identify
the rows that should be updated.

Fix this by ensuring that `_fs_to_record_path` is always called with a base
directory. `_record_to_fs_path` also needs a a base directory parameter to
be able to transform the path back into an absolute path, so add one.
2022-06-25 01:27:08 +03:00
Stéphane Bidoul 25dd00571a
Merge pull request #11022 from SpecLad/download-propagate-pep517
pip download: make sure that --use-pep517 is propagated to the dependencies
2022-06-24 19:42:58 +02:00
Stéphane Bidoul 3726f71720
Add a --dry-run option to pip install 2022-06-23 19:33:18 +02:00
q0w c8c88ce520 Adapt tests 2022-06-23 19:20:18 +03:00
q0w 49657d8c94 Use os.fspath 2022-06-21 19:35:22 +03:00
q0w 3181063f94 Convert to str shutil.move src arg for py<=39
https://github.com/python/cpython/issues/76870
2022-06-15 22:07:15 +03:00
Роман Донченко 28d7730087 test_download_use_pep517_propagation: use a different approach
The approach it uses now doesn't work anymore due to 452d7da8.
The installation of `fake_dep` now succeeds whether or not `setuptools`
is installed in the test environment.

Use a different approach instead: try to import `pip` in the `setup.py`
script. If it succeeds, then we are not running in an isolated environment,
and therefore PEP 517 isn't being used.

To add this custom logic to `setup.py`, add a new argument to
`create_basic_sdist_for_package`. Note that to make this work, I had to
switch from f-strings to `str.format`, since the `dedent` has to happen
before formatting.
2022-06-15 18:11:07 +03:00
Роман Донченко 698784796b pip download: make sure that --use-pep517 is propagated to the dependencies 2022-06-15 18:10:22 +03:00
Tzu-ping Chung 42359a9605 Migrate tests to use pathlib.Path
The pip-specific Path implementation has been removed, and all its
usages replaced by pathlib.Path. The tmpdir and tmpdir_factory fixtures
are also removed, and all usages are replaced by tmp_path and
tmp_path_factory, which use pathlib.Path.

The pip() function now also accepts pathlib.Path so we don't need to put
str() everywhere. Path arguments are coerced with os.fspath() into str.
2022-06-08 19:58:46 +08:00
Stéphane Bidoul e58a8a591b
Merge pull request #11137 from sbidoul/download-info-sbi
Add download_info: DirectUrl to InstallRequirement
2022-06-01 08:21:12 +02:00
Tzu-ping Chung b91dbde21f
Merge pull request #11082 from uranusjr/truststore 2022-05-30 02:32:49 -04:00
Pradyun Gedam 90096394c3
Merge pull request #11134 from q0w/revert-10998-handle-netrc
Revert "Prioritize url credentials over netrc"
2022-05-25 12:38:57 +05:30
Stéphane Bidoul e7449498d3
Record origin url in wheel cache 2022-05-22 22:46:35 +02:00
Pradyun Gedam f20ab575b9
Merge pull request #11124 from uranusjr/use-contain-for-checking
Allow pre-release to satisfy build requirements
2022-05-16 15:05:40 +01:00
Tzu-ping Chung f7c05a5124 Allow pre-release to satisfy build requirements 2022-05-16 07:40:00 -04:00
Pradyun Gedam 30af8074bf
Merge pull request #11117 from q0w/opt-check
Opt to check build dependencies
2022-05-14 21:55:18 +01:00
q0w e20aab9901 Revert "Merge pull request #10998 from q0w/handle-netrc"
This reverts commit eacc739320, reversing
changes made to d5e1eeecc8.
2022-05-14 20:48:29 +03:00
q0w 3166157e40 Opt to check build dependencies 2022-05-13 03:05:55 +03:00
Pradyun Gedam 611e9253ff
Filter out build requirements that require an extra to be used
There is no mechanism provided for build requirements to have extras.

It should be acceptable to enforce that any "optional" packages
that are supposed to be conditionally installed based on the presence of
an extra should not be installed in a build environment.
2022-05-12 01:04:11 +01:00
Pradyun Gedam cb24fb4052
Merge pull request #11085 from pypa/revert-10962-fix-hashes 2022-05-09 08:38:51 +01:00
Tzu-ping Chung a020e8c35c Add very simple tests to ensure feature is enabled 2022-05-03 11:04:05 -06:00
Pradyun Gedam 2d028e140e Revert "Filter available distributions using hash declarations from constraints files (#10962)"
This reverts commit 0c284520c6.
2022-05-03 17:50:21 +01:00
Stéphane Bidoul 3c62d1cbce
Add failing test for REQUESTED and URL constraints 2022-05-01 19:39:17 +02:00
Paul Moore cdeb8f9e63
Merge pull request #11059 from pfmoore/config_settings
Add a UI to set config settings for PEP 517 backends
2022-04-29 12:58:32 +01:00
Pradyun Gedam 7164b1af50
Merge pull request #10827 from q0w/project-urls
Include Project-URLs in `pip show -v` output
2022-04-23 21:39:51 +01:00
Paul Moore 4db45851b6 Explicitly test installs (and fix a bug found by those tests!) 2022-04-23 13:14:22 +01:00
Paul Moore 1401dbae56 Add an end-to-end test for config settings 2022-04-21 18:30:48 +01:00
Tzu-ping Chung 8133d83929
Merge pull request #11030 from uranusjr/build-env-req-check-evaluate-marker 2022-04-16 19:46:23 +08:00
Tzu-ping Chung 233db7c31b Skip conditional build req without matching marker 2022-04-16 16:02:15 +08:00
Pradyun Gedam c6e274e7fd
Merge pull request #10709 from uranusjr/metadata-importlib-backend 2022-04-15 12:49:32 +01:00
Frost Ming 6a1ed5c0f4
Add completion script for powershell (#9025) 2022-04-15 09:32:42 +01:00
Tzu-ping Chung 8073f65c14 Properly normalize and handle linked dist 2022-04-12 03:33:18 +08:00
Tzu-ping Chung 17355f8d47 Unnormalized metadata version works now! 2022-04-12 03:33:18 +08:00
Tzu-ping Chung 675de98f42 Better test setup and teardown with fixture 2022-04-12 03:31:50 +08:00
Pradyun Gedam e679df4051
Merge pull request #11001 from pradyunsg/remove-out-of-tree
Drop out-of-tree/in-tree build transition flags
2022-04-09 16:02:40 +01:00
Pradyun Gedam 428e886ad6
Drop out-of-tree/in-tree build transition flags
These were intended to help users transition when the default behaviour
changed to no longer perform out-of-tree builds. The transition is now
considered complete.
2022-04-08 12:20:36 +01:00
q0w b953f9aaa7 Use explicit wrong credentials 2022-04-07 11:15:48 +03:00
q0w ee67cf714b Prioritize url credentials over netrc 2022-03-29 20:27:24 +03:00
q0w db71def50f replace git scheme with https 2022-03-19 14:17:05 +03:00
Pradyun Gedam 25861e564d
Merge pull request #10560 from pradyunsg/fix-protect-pip-on-windows
Fix the protect-pip-on-windows logic
2022-03-18 12:32:18 +00:00
q0w 0c284520c6
Filter available distributions using hash declarations from constraints files (#10962) 2022-03-16 07:43:06 +00:00
q0w a4f7508592
Drop the doctype check (#10906)
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2022-02-27 12:39:06 +00:00
Pradyun Gedam ce30e6c532
Fix the protect-pip-on-windows logic
The names for the executables does not contain a `.exe` suffix anymore.
2022-02-26 12:32:52 +00:00
Pradyun Gedam 201135fd2e Normalise name to match newer flit behaviour 2022-02-25 12:08:44 +00:00
q0w 0c6d20f8c7
Validate build deps when --no-build-isolation is passed (#10886)
This can help catch issues in setting up the build environment, helping
ensure that packages get built according to their declared metadata.
2022-02-18 14:58:40 +00:00
Shivansh-007 5086e57997
Add test for failed parse log with invalid git version 2022-02-18 18:32:24 +05:30
Tzu-ping Chung ec8edbf5df
Merge pull request #10819 from q0w/file404 2022-02-03 20:37:38 +08:00
q0w 7f6a9cad22 Add test 2022-02-03 14:57:21 +03:00
q0w 8749d0baad Add docstring 2022-02-02 21:11:23 +03:00
Pradyun Gedam a78845ab33
Pacify functional tests that don't start with <!doctype html> 2022-01-30 21:57:22 +00:00
Jon Dufresne bf5f4008e7
Replace vendored html5lib with stdlib
The html5lib library isn't strictly required as the same functionality
can be achieved through the stdlib html.parser module.

The html5lib is one of the largest uses of the six library. By dropping
this unnecessary dependency, the pip project is closer to dropping the
six library.

Additionally, html5lib maintenance has slowed down and the project has
rejected pull requests to drop Python 2 support.

For now, the html5lib code remains, but is gated behind a command
line option: `--use-deprecated=html5lib`. After a sufficient amount of
time has passed without any reported bugs, the vendored library and this
flag can be removed completely.
2022-01-28 06:45:57 +00:00
Pradyun Gedam 9d0db8839f
Add --use-deprecated=backtrack-on-build-failures
This serves as an opt-out from build failures causing the entire
installation to abort.
2022-01-27 18:11:05 +00:00
Pradyun Gedam ca78aba456
Test that the resolver skips packages, as instructed by constraints 2022-01-27 18:11:05 +00:00
Pradyun Gedam 8eeee22304
Abort immediately on metadata generation failure instead of backtracking
This behaviour is more forgiving when a source distribution cannot be
installed (eg: due to missing build dependencies or platform
incompatibility) and favours early eager failures instead of trying to
ensure that a package is installed regardless of the amount of effort it
takes.
2022-01-27 18:11:02 +00:00
Pradyun Gedam 1cda23bd6b
Merge pull request #10795 from pradyunsg/better-subprocess-errors 2022-01-27 07:09:18 +00:00
Andy Freeland e752b1a26b
Include files/folders in pip install autocomplete (#10682) 2022-01-25 18:27:09 +00:00
q0w 24bee84f44 Show Project-URLs 2022-01-25 18:26:06 +03:00
James Gerity 5c24a798b8
Change VCS tooling verbosity along with pip's verbosity (#9639)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2022-01-25 08:54:02 +00:00
Pradyun Gedam deb2d754e7
Tweak the chattymodule to not leak potentially information
I'd like to use this in screenshots, but the os.environ makes it a bit
tricky to do.
2022-01-25 01:38:23 +00:00
Pradyun Gedam a835e0a277
Prettify messages for discarding candidates due to issues
These are more pleasing colours and, more importantly, a clearer
presentation style of the package vs the error.
2022-01-25 01:38:23 +00:00
Pradyun Gedam 57198c6688
Use logger.warning instead of warnings.warn
This is more in line with the rest of our output presentation logic.
2022-01-25 01:38:22 +00:00
Pradyun Gedam 531c991ef9
Require every call_subprocess call-site to pass command_desc
This serves as additional context that can be presented in error
messages.
2022-01-25 01:38:22 +00:00
Pradyun Gedam 42075efa61
Annotate an unannotated test 2022-01-25 01:32:34 +00:00
Pradyun Gedam 997c5a742b
Merge pull request #10625 from albertosottile/ignore_yanked 2022-01-24 23:47:54 +00:00
Pradyun Gedam b82dfd1745
Restore colors in regular logging messages
Also, reflects that `--no-color` does not mean no-ansi-escapes but only
affects colour rules.
2021-12-12 13:11:36 +00:00
Thomas VINCENT 077867237b Add test to reproduce issue #10222 2021-12-06 15:54:07 +01:00
Tzu-ping Chung 496343ead0 Fix in-site-packages patch for user install tests 2021-12-04 17:57:34 +08:00
Tzu-ping Chung 6ed6aa819f Fix test failures caused by name normalization 2021-12-04 17:57:34 +08:00
Dustin Ingram 06cd803328
Add type annotations 2021-12-02 16:43:03 -05:00
Dustin Ingram 772a17c698
Add failing test 2021-12-02 15:57:17 -05:00
Tzu-ping Chung e0c7f24ee4
Merge pull request #10511 from uranusjr/metadata-uninstall 2021-11-22 09:54:15 +08:00
Tzu-ping Chung f9250d29c9 Fix typing for uninstallation test 2021-11-21 23:43:49 +08:00
Jon Dufresne c71cf88049 Complete type annotations of tests/functional/ directory 2021-11-18 18:26:17 -08:00
Tzu-ping Chung ebd693e0b5 Abstract pkg_resources from uninstall operation 2021-11-18 17:55:38 +08:00
Pradyun Gedam e7c80c7b46
Merge pull request #10535 from lukasjuhrich/main 2021-11-12 09:57:11 +00:00
Alberto Sottile 51bda9637b Lint 2021-11-06 16:27:39 +01:00
Alberto Sottile 99cb1e0fc3 Add test_error_all_yanked_files_and_no_pin test 2021-11-06 16:22:56 +01:00
Pradyun Gedam c99e91224c
Merge pull request #10538 from pradyunsg/diagnostic-errors 2021-10-29 12:44:16 +01:00
Tzu-ping Chung c4d9f563dd Add failing test for extra-already-installed case 2021-10-23 23:49:30 +08:00
Lukas Juhrich 58996b5ddb Add tests for BadZipFile handling
Note that the functional test does not actually detect the behavioral
change of throwing unhandled `BadZipFile` → throwing unhandled
`InvalidWheel`, whereas the unit test does.
2021-10-23 17:42:22 +02:00
Pradyun Gedam a00e7bcd88
Implement diagnostic errors for build-system.requires issues
This demonstrates how the new diagnostic errors are to implement, and
how they get presented to users.
2021-10-22 13:47:53 +01:00
Stéphane Bidoul 619b257ed9
Add failing tests for issue 10573 2021-10-18 14:31:11 +02:00
Stéphane Bidoul ddfeaaef20
Reject projects that have neither a pyproject.toml nor a setup.py 2021-10-18 14:31:11 +02:00
Alex Hedges e1f81bfa4d Fix many typos 2021-10-11 15:48:17 -04:00
Pradyun Gedam 786957cf85
Use a shorter timeout, to ensure that this fails more often 2021-10-09 11:34:23 +01:00
Pradyun Gedam ae2c9eda54
Merge pull request #10543 from pradyunsg/drop-sdist-reinstall
Un-deprecate source distribution re-installation behaviour
2021-10-09 07:37:36 +01:00
Diego Ramirez 02b4f86489
Return a better error message if a file: URL is not found (#10263)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2021-10-08 14:24:54 +01:00
Pradyun Gedam 68e22aa959
Un-deprecate source distribution re-installation behaviour
This will be handled as part of a broader effort to make the reinstall
behaviours more ergonomic and easier to reason about.
2021-10-08 12:22:15 +01:00
Pradyun Gedam bc98892d0b
Drop --build-dir from the CLI
This was restored as a no-op for PyCharm, as a way to soften the
migration for them. It is no longer necessary, since the migration has
completed.
2021-10-04 22:35:48 +01:00
Pradyun Gedam 9a058c62b7
Fix a failing test
This was caused due to an overlap between two PRs which ended up being
incompatible.
2021-10-02 15:01:05 +01:00
Pradyun Gedam a07bfb33a0
Merge pull request #10495 from sbidoul/out-of-tree-build-flag 2021-10-02 12:34:24 +01:00
Jon Dufresne b0bf93f174 Remove unconditionally skipped test (fails if skip removed)
The test was introduced in f9990605dc (May
2017) and was unconditionally skipped in
6cf5d7db54. It remains skipped to this
day.

In commit bd850c0798, the patched_file
method was removed/renamed. So even if the skip were removed, it would
fail on the undefined attribute.

This was caught via mypy which emits an error due to the missing method.
2021-09-30 04:58:49 -07:00
Tzu-ping Chung cb2d4b89a7
Merge pull request #10526 from uranusjr/remove-extra-merge-xfail 2021-09-30 16:34:39 +08:00
Tzu-ping Chung 12cb745985 Remove xfail from a weird but passing test 2021-09-30 15:59:58 +08:00
Tzu-ping Chung fbdc4648c2 Remove --build xfail for now
The option is current restored. We should remove this test after the
option is removed (again).
2021-09-30 15:55:57 +08:00
Tzu-ping Chung ad9b041650 Don't skip extra-merging test on 2020 resolver 2021-09-30 01:37:22 +08:00
Stéphane Bidoul 348d884d09
Merge pull request #8212 from sbidoul/pep517-editable-sbi
PEP 660 (build_editable) support
2021-09-29 11:36:06 +02:00
Pradyun Gedam 8ea265186a
Merge pull request #10459 from NoahGorny/do-not-throw-error-on-cache-purge 2021-09-28 22:53:34 +01:00
Stéphane Bidoul e5be3f796e
Add PEP 660 support (build_editable) 2021-09-28 23:04:51 +02:00
Noah Gorny 2d3f17c214 tests: cache: Add no files to remove cases 2021-09-28 14:18:52 +03:00
Stéphane Bidoul 040cc391ba
Make in-tree-build the default
Add an out-of-tree-build feature flag to ease the transition.
2021-09-25 13:11:01 +02:00
Tzu-ping Chung 605d68ead3
Merge pull request #10492 from jdufresne/with-wheel
Use @pytest.mark.usefixture("with_wheel") in tests
2021-09-21 21:27:29 +08:00
Stéphane Bidoul 0199c500f0
Use editable project location in pip freeze 2021-09-21 11:18:00 +02:00
Stéphane Bidoul d251b4bf94
Add editable project location to pip list output 2021-09-21 11:18:00 +02:00
Jon Dufresne fa0804b98c Use @pytest.mark.usefixture("with_wheel") in tests
The with_wheel fixture doesn't have a value and isn't ever referenced
within a test function.

To avoid typing it every test function, change tests to use
pytest.mark.usefixture. It will no longer appear as an argument.

https://docs.pytest.org/en/latest/how-to/fixtures.html#use-fixtures-in-classes-and-modules-with-usefixtures
2021-09-20 21:44:29 -07:00
Tzu-ping Chung 9c3286873b
Merge pull request #10465 from jdufresne/mypy-pytest
Install pytest in mypy environment
2021-09-21 06:10:57 +08:00
Pradyun Gedam 4c609d5b68
Merge pull request #10437 from jdufresne/unused-tmpdir 2021-09-20 19:12:59 +01:00
Tzu-ping Chung 0de0b8dd9f
Merge pull request #10448 from jdufresne/unused-test-class
Remove unused class TestUpgradeDistributeToSetuptools
2021-09-15 14:25:23 +08:00
Jon Dufresne 426691dc14 Install pytest in mypy environment
pytest includes type annotations and is PEP-561 compliant. This helps
ensure correct pytest API usage.

This caught a misuse of pytest.mark.skipif which did not include a
boolean argument. The test is now marked "network" and no longer
skipped.
2021-09-12 20:49:56 -07:00
Jon Dufresne 5c6169465e Remove unused class TestUpgradeDistributeToSetuptools
Unused since 6b54145783 when the last test
method was removed.

Removing the class avoids the need to add type annotations.
2021-09-12 12:55:09 -07:00
Jon Dufresne a4f483e96f Handle TODO comment in tests/functional/test_new_resolver.py 2021-09-12 12:54:54 -07:00
Jon Dufresne 8c5d3556bd Fix failing test due to removed setuptools feature, use_2to3
setuptools removed use_2to3 in version v58.0.1 (2021-09-06). Some tests
install the anyjson package which uses this feature and so those tests
result in a command failure. The failure appeared as:

    error in anyjson setup command: use_2to3 is invalid.

As anyjson package is no longer maintained (last release was 2012),
change the tests to use a package that is healthy.

For details on the setuptools change, see the history at:

https://setuptools.readthedocs.io/en/latest/history.html#v58-0-2
2021-09-08 05:37:55 -07:00
Jon Dufresne ad25b61e07 Remove unused tmpdir fixtures from tests
There was also one unused monkeypatch fixture removed.
2021-09-05 07:08:06 -07:00
Jon Dufresne 4a4103e173 Replace use of pretend library with unitest.mock in tests
The pretend library was used by very few tests. In all cases, it is
simple enough to switch to stdlib unitest.mock.

Using stdlib means there is one fewer library to install before running
tests. It can also simplify mypy usage via typeshed.
2021-09-03 16:23:28 -07:00
Jon Dufresne a775351a38 Clean up leftover references to removed Travis and Azure CI 2021-08-28 20:01:58 -07:00
Jon Dufresne 943af79f26 Run mypy on the tests directory
The tests are a large consumer of the pip API (both the internal API and
otherwise). By running mypy on tests, we help to:

1. Ensure the internal API is consistent with regards to typing

2. Ensure the tests are representative of real life scenarios as the API
   are used correctly.

3. Helps to recognize unnecessary tests that simply pass junk data to
   functions which can be caught by the type checker.

4. Make sure test support code in tests/lib/ is correct and consistent.
   This is especially important when refactoring such code. For example, if
   we were to replace tests/lib/path.py with pathlib.

As a first start, untyped defs are allowed. All existing typing issues
have been resolved. Overtime, we can chip away at untyped defs and
eventually remove the configuration option for stricter type checking of
tests.

The following changes were made to help make mypy pass:

Remove unused record_callback argument from make_wheel() in tests.
Unused since its introduction in
6d8a58f7e1.

Replace toml with tomli_w in tests/functional/test_pep517.py. Unlike the
toml package, tomli_w contains inline typing annotations.

Remove unnecessary make_no_network_finder(). Unnecessary since
bab1e4f8a1 where the _get_pages method was
removed.
2021-08-22 09:57:26 -06:00
Jon Dufresne d144fd960c Cleanup several Python 2 version_info checks/workarounds 2021-08-20 09:39:31 -06:00
Pradyun Gedam 585037a80a
Cleanup implicit string concatenation 2021-08-20 13:37:52 +01:00
Pradyun Gedam 94999255d5
Reformat the codebase, with black 2021-08-20 13:37:49 +01:00
Pradyun Gedam df501bcf96
Enforce keyword arguments in deprecated 2021-08-15 19:15:52 +01:00
Nipunn Koorapati 2d35b8072c Use git's partial clone feature to speed up pip
Clone with --filter=blob:none - as it fetches all
metadata, but only dynamically fetches the blobs as
needed by checkout. Since typically, pip only needs the blobs for
a single revision, this can be a big improvement, especially
when fetching from repositories with a lot of history,
particularly on slower network connections.

Added unit test for the rev-less path. Confirmed that both
of the if/else paths are tested by the unit tests.
2021-08-13 11:44:01 -07:00
Pradyun Gedam b9f829553d
Merge pull request #10302 from nipunn1313/blacken_tests42
Run black on tests/functional/test_vcs_bazaar.py
2021-08-13 11:00:09 +01:00
Nipunn Koorapati 7e7c10ab4d Run black on tests/functional/test_new_resolver_errors.py 2021-08-11 13:24:05 +08:00
Nipunn Koorapati 1b15952618 Run black on tests/functional/test_hash.py 2021-08-11 13:23:50 +08:00
Nipunn Koorapati 7495e786f2 Run black on tests/functional/test_vcs_subversion.py 2021-08-11 13:23:44 +08:00
Nipunn Koorapati d03b8a84a2 Run black on tests/functional/test_uninstall_user.py 2021-08-11 13:23:39 +08:00
Nipunn Koorapati ba5a6784ed Run black on tests/functional/test_new_resolver_target.py 2021-08-11 13:23:32 +08:00
Nipunn Koorapati 13068687a7 Run black on tests/functional/test_new_resolver_hashes.py 2021-08-11 13:23:23 +08:00
Tzu-ping Chung 36877e327a
Merge pull request #10317 from nipunn1313/blacken_tests10
Run black on tests/functional/test_fast_deps.py
2021-08-11 13:22:10 +08:00
Tzu-ping Chung c1c74dcaeb
Merge pull request #10318 from nipunn1313/blacken_tests24
Run black on tests/functional/test_install_requested.py
2021-08-11 13:21:59 +08:00
Tzu-ping Chung bf91a07979
Merge pull request #10287 from jdufresne/com2ann
Move many type comments to annotations
2021-08-11 13:20:45 +08:00
Tzu-ping Chung fcc61e8630
Merge pull request #10339 from nipunn1313/blacken_tests38 2021-08-11 13:20:03 +08:00
Nipunn Koorapati dc9ef9d252 Run black on tests/functional/test_search.py 2021-08-10 11:21:20 -07:00
Jon Dufresne 6a6561c2cb Move many type comments to annotations
Use the tool com2ann to automatically convert most type comments to type
annotations. Some type comments continue to exist where any work beyond
the automatic conversion was required (for example, additional
formatting or circular references).

For additional information on the com2ann tool, see:
https://github.com/ilevkivskyi/com2ann
2021-08-10 07:12:32 -07:00
Nipunn Koorapati 319f81bc5d Run black on tests/functional/test_vcs_bazaar.py 2021-08-09 01:18:44 -07:00
Nipunn Koorapati 75332ac633 Run black on tests/functional/test_fast_deps.py 2021-08-09 01:18:43 -07:00
Nipunn Koorapati 7a19a9eed9 Run black on tests/functional/test_install_requested.py 2021-08-09 01:18:43 -07:00
Pradyun Gedam df98748391
Skip warnings-as-errors test
There is no clean way, that we know of so far, for fixing this on 3.10+.
2021-08-06 13:42:31 +01:00
Tzu-ping Chung 6a228068fb
Correctly normalize relative paths for 'pip show' 2021-07-31 14:55:43 +08:00
Tzu-ping Chung 95fa4e5a2a Respect the base's constraint for extra-ed package 2021-07-30 20:13:25 +08:00
Guy Tuval 239a307372
Error handling upon uninstall invalid parameter (#10171)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
2021-07-24 21:24:30 +08:00
Pradyun Gedam a196b3bf01
Minor formatting tweaks (#10190)
Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2021-07-24 03:55:14 +08:00
Tzu-ping Chung 6db400328b Add test case for file://localhost/ usages 2021-07-23 15:38:00 +08:00
Tzu-ping Chung 6af7739596
Merge pull request #10157 from uranusjr/metadata-refactor-2107
Replace more pkg_resources usages
2021-07-23 11:04:45 +08:00
Tzu-ping Chung d4d2445350 Remove get_installed_distributions usages
The function itself is kept for now because it's currently used to test
the pip.metadata subpackage...
2021-07-22 23:22:12 +08:00
Tzu-ping Chung 26778e9436
Merge pull request #10079 from new-resolver-url-equivalent-no-hash
Smarter (and looser) link equivalency logic
2021-07-22 15:45:13 +08:00
Harutaka Kawamura 567282724d
Log commit SHA when installing package via Git URI (#10149)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
2021-07-22 15:29:16 +08:00
Tzu-ping Chung 2da77e97a2 Smarter (and looser) link equivalency logic 2021-07-22 15:27:10 +08:00
Tzu-ping Chung 6f1c5dc949 Remove pkg_resources usages from 'pip freeze' 2021-07-22 15:25:18 +08:00
Tzu-ping Chung 19389df484 Fix expected error message format 2021-07-22 15:20:50 +08:00
Tzu-ping Chung ead43d674d Add method to access the raw project name 2021-07-22 15:20:49 +08:00
Tzu-ping Chung 5f47421313 Remove pkg_resources usages from 'pip show' 2021-07-22 15:20:49 +08:00
Xavier Fernandez 1f1e1d6211 Remove deprecated --find-links option from pip freeze 2021-07-13 22:15:07 +02:00