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

145 commits

Author SHA1 Message Date
Stéphane Bidoul 8f0ed32413 Redact URLs in Collecting... logs 2023-10-14 14:02:55 +02:00
Ales Erjavec 660dafb37f Ignore errors in temporary directory cleanup
pip should not exit with an error when it fails to cleanup temporary
files after it has already successfully installed packages.
2023-07-17 15:15:41 +02:00
Stéphane Bidoul 8e2205d849 Add function to check hashes against known digests 2023-04-14 08:03:48 +02:00
Pradyun Gedam 78ab4cf071
Bump all linters other than mypy (#11901) 2023-03-27 20:03:11 +01:00
Роман Донченко 44c1ccaf40 Replace deprecated setup/teardown usage
As explained in
<https://docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose>,
`setup`/`teardown` are a part of nose compatibility, which is deprecated.
You're supposed to use `setup_method` and `teardown_method` instead.
2023-01-27 22:00:50 +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
Pradyun Gedam 723b2df7b4
Double-escape paths on Windows
This helps ensure that they aren't improperly handled due to the newer
string-in-string design for the setuptools invocation script.
2022-01-25 08:24:31 +00:00
Pradyun Gedam 7a13f7c213
Improve our setuptools shim
Modernise the shim, to account for the Python 3.2+ support matrix.

This also presents clearer error messages on failures, the included
comment helps inform users about why this shim exists and the traceback
now explicitly mentions `<pip-setuptools-shim>` to make it clearer to
users that this shim exists.
2022-01-25 01:38:22 +00:00
Tzu-ping Chung cd01e4fd8f Remove pkg_resources usages from utils modules
Relevant functionalities are moved into pip._internal.metadata.
2021-12-04 17:57:33 +08:00
Jon Dufresne 60c274be2d Complete type annotations of tests/unit/ directory 2021-09-23 05:44:54 -07:00
Stéphane Bidoul 2de1e5b1bf
Remove egg_link_path() 2021-09-21 11:18:02 +02:00
Stéphane Bidoul 5fa413d363
Extract egg_link* function to a separate module 2021-09-21 11:18:02 +02:00
Stéphane Bidoul d051a00fc5
Remove unused get_installed_distributions 2021-09-21 11:18:01 +02: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 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
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 10c0f0d637
Hide feature flag if deprecated behaviour is gone 2021-08-15 19:15:53 +01:00
Pradyun Gedam 7bbbaa3857
Test the feature_flag argument in deprecated helper
This wasn't covered properly in the PR that introduced this.
2021-08-15 19:15:53 +01:00
Pradyun Gedam 7120590935
Tweak wording in deprecation messages
- Avoid a period at the end of `issue` line.
- Change post-gone message wording.
2021-08-15 19:15:53 +01:00
Pradyun Gedam df501bcf96
Enforce keyword arguments in deprecated 2021-08-15 19:15:52 +01:00
Ben Mares dbf994e160 Add canned explanation about feature preview flag
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com> and
Pradyun Gedam <pradyunsg@gmail.com>
2021-07-28 00:26:36 -07:00
Jon Dufresne 3f6df167e0 Remove Python 2 compat shim path_to_display()
Per the function's type signature, this accepted either a str or None.
In both cases, the value was returned unaltered. Since dropping Python
2, it has been unnecessary.
2021-02-19 05:45:59 -08:00
Andrey Bienkowski 50db373adb Lint 2021-02-10 13:38:21 +03:00
Andrey Bienkowski ab35018c04 Use unittest.mock instead of mock 2021-02-10 13:28:55 +03:00
Tzu-ping Chung 349bb730de Move dist-related logic from misc into metadata 2021-01-19 14:42:55 +08:00
Jon Dufresne a49f1732e9 Remove unnecessary __ne__ definitions
Unnecessary since dropping Python 2 support. In Python 3, `__ne__`
defaults to the opposite of of `__eq__`.

https://docs.python.org/3/reference/datamodel.html#object.__ne__

> For `__ne__()`, by default it delegates to `__eq__()` and inverts the
> result unless it is `NotImplemented`.
2020-12-30 08:23:04 -08:00
Pradyun Gedam 86afa89043
Merge pull request #9361 from jdufresne/f-strings
Use f-strings for simple string formatting
2020-12-26 10:24:18 +00:00
Jon Dufresne cdcf74fb8e Use f-strings for simple string formatting
Use pyupgrade to convert simple string formatting to use f-string
syntax. pyupgrade is intentionally timid and will not create an f-string
if it would make the expression longer or if the substitution parameters
are anything but simple names or dotted names.
2020-12-25 16:21:20 -08:00
Jon Dufresne 09b3d3a50b Remove object from class definitions
Unnecessary since dropping Python 2 support. In Python 3, all classes
are new style classes.
2020-12-25 15:48:11 -08:00
Jon Dufresne ba40f58ecc Remove encoding cookie from Python source files
Unnecessary since dropping Python 2. Python now decodes files as utf-8
by default.
2020-12-25 07:26:07 -08:00
Jon Dufresne 2e38024991 Drop u prefix from str literals
Unnecessary since dropping Python 2 support.

This makes one test case from test_str_to_display a duplicate and so has
been removed.
2020-12-25 07:26:06 -08:00
Xavier Fernandez 4dc48da9db utils: make Hashes object hashable 2020-10-31 15:54:54 +01:00
Pradyun Gedam 58c594c06b
Prepare isort for black 2020-09-23 21:47:47 +05:30
Tzu-ping Chung 4fce2ea88c Add test to ensure get_distribution() behavior 2020-08-06 10:59:07 +08:00
gutsytechster b30dd1e04e fix(tests/unit): Update tests to be endian safe
This updates `test_path_to_display` and `test_str_to_display__encoding`
to use the endian safe expected result instead of the hardcoded one.

This fixes https://github.com/pypa/pip/issues/7921
2020-05-03 22:51:00 +05:30
Nguyễn Gia Phong 26b76f6f11 Move tabulate to utils.misc and test it 2020-04-07 17:35:47 +07:00
Anudit Nagar 082c0f01d2
Update old-style formatting to new-style formatting (#7762) 2020-02-21 21:48:14 +05:30
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 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
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 f805f328d4 Align interface of tests.lib.path.Path.mkdir with pathlib.Path.mkdir. 2019-10-06 21:55:10 -04:00
Emil Burzo 5089b84c56 rewrite tests using pytest.mark.parametrize 2019-10-02 08:51:32 +03:00
Emil Burzo 004103c0f5 fix code quality issues 2019-10-02 08:33:41 +03:00
Emil Burzo 6f7c304167 add tests 2019-10-02 08:25:56 +03:00
Pradyun Gedam e9d79db6c4
Move tests for utils.subprocess to dedicated file 2019-09-30 11:42:08 +05:30
Pradyun Gedam b447f438df
Move path_to_url() to utils/urls.py (#7075) 2019-09-25 10:00:33 +05:30
Chris Jerdonek 0435316fde Move path_to_url() to utils/urls.py. 2019-09-24 02:01:52 -07:00
Chris Hunt 236fb82a1f Move temp_dir tests to separate file 2019-09-23 18:47:28 -04:00