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

164 commits

Author SHA1 Message Date
Jon Dufresne a6392bd62e Replace pip._internal.utils.typing with stdlib typing
The stdlib module has been available since Python 3.5 and the
TYPE_CHECKING constant has been available since 3.5.2.

By using stdlib, this removes the need for pip to maintain its own
Python 2 typing compatibility shim.
2021-02-18 19:09:13 -08:00
Tzu-ping Chung 5fac450375
Merge pull request #9368 from jdufresne/ensure
Remove unnecessary uses of six.ensure_(binary|str|text)
2021-02-18 20:40:21 +08:00
Jon Dufresne 8683413501 Use keyword-only arguments
https://www.python.org/dev/peps/pep-3102/

Replaces the pattern: self.name = kwargs.pop('name')

Keyword-only arguments offer some advantages:

- In the event of a typo or misuse, a more informative error is
  presented to the programmer.

- More self documenting and makes interfaces more explicit.

- They more easily allow explicit typing.

Adding types to ConfigOptionParser required changing some call sites to
pass arguments without using a dict due to mypy bug:
https://github.com/python/mypy/issues/9676
2021-01-29 21:15:36 -08:00
Jon Dufresne c115cdc81a Remove unnecessary uses of six.ensure_(binary|str|text)
Now that Python 2 is not supported, the bytes/str boundaries are more
clear and explicit. Using six.ensure_* methods for backwards
compatibility is no longer necessary as the types are known and verified
using mypy.

One exception is tests/lib/wheel.py which allows tests to pass test
setup data as either bytes or str.

The module operations.install.wheel also remains untouched as it is
especially delicate to bytes/str mixups and the current version is
working.
2020-12-27 07:56:18 -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
Pradyun Gedam f91ba6b348
Merge pull request #9354 from jdufresne/super
Use short Python3 super() syntax
2020-12-25 19:18:28 +00: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
Jon Dufresne c148bcc1aa Use short Python3 super() syntax 2020-12-24 15:11:51 -08:00
Jon Dufresne f32adaf09b Remove __future__ imports
Unnecessary since dropping Python 2.
2020-12-24 08:38:09 -08:00
Hugo van Kemenade 9db97546b3 os.curdir is already a str
Co-authored-by: Jon Dufresne <jon.dufresne@gmail.com>
2020-12-22 22:41:58 +02:00
Hugo van Kemenade 817ee23051 Remove redundant Python 2.7 code 2020-12-22 09:06:26 +02:00
Pradyun Gedam 25ab172b55
Update linter: isort 2020-09-23 19:52:28 +05:30
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
Devesh Kumar Singh db11f83e2a Fix tests module with flake8-bugbear 2020-06-05 02:41:08 +05:30
Sumana Harihareswara cef69fef7f Updated author email in configuration and tests
Per https://groups.google.com/d/msg/pypa-dev/rUNsfIbruHM/LCEx-CB5AgAJ
the pypa-dev Google Group is now decommissioned.
Using distutils-sig instead as author/maintainer email.

Signed-off-by: Sumana Harihareswara <sh@changeset.nyc>
2020-05-28 16:51:02 -04:00
Pradyun Gedam 2552151858
Add helpers to TestPipResult 2020-05-22 17:27:44 +05:30
Paul Moore 80c640b5a8
Merge pull request #8067 from deveshks/fix-create-basic-wheel-bug
Canonicalise package name in tests.lib.create_basic_wheel_for_package
2020-05-21 13:54:01 +01:00
Ilan Schnell 28b0fd353b add allow_error parameter to .run() method 2020-04-28 22:49:18 -05:00
Devesh Kumar Singh 7bcccbd3dc Canonicalise package name in tests.lib.create_basic_wheel_for_package 2020-04-17 01:21:51 +05:30
Paul Moore 037791d170 Add a test demonstrating #7966 2020-04-03 11:18:44 +01:00
Tzu-ping Chung 22f7c883ad Requires-Python support in test helper 2020-04-02 18:38:43 +08:00
Tzu-ping Chung 09f4d0004b Use extra_files to write package files instead 2020-04-02 01:25:05 +08:00
Tzu-ping Chung 2c8a0bff42 Rewrite tests.lib.create_basic_wheel_for_package
This implementation uses tests.lib.make_wheel, which allows more
flexible wheel configuration in a more structured way.

Output-wise this should be almost identical to the previous
implementation, with the following exceptions:

* Metadata-Version is bumped from 2.0 (previous implementation) to 2.1
  (from make_wheel).
* Fields previously supplied as UNKNOWN are now omitted since they are
  not significant to tests.
* The DESCRIPTION file is omitted (since the description field is now
  missing, see previous point).
2020-03-30 03:20:00 +08:00
gutsytechster 315447d170 fix(tests/lib): Catch subprocess.CalledProcessError in need_executable
This fixes https://github.com/pypa/pip/issues/7924
2020-03-29 16:21:02 +05:30
Jason R. Coombs fd288ab0e5 Merge remote-tracking branch 'origin/master' into bugfix/6973-format-method 2020-03-06 18:17:10 -05:00
Jason R. Coombs 3511d3d493 Convert the remaining '%' formatters to '.format'. Fixes #6973. 2020-03-06 12:43:03 -05:00
Jason R. Coombs 2c0d691893 Skip svn tests if svnadmin is not available. Fixes #7823. 2020-03-06 04:09:48 -05:00
Chris Hunt dd8753cdee Mitigate Windows test failures due to PAX-format wheel release 2020-01-29 08:53:23 -05: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
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 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 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
Chris Hunt 0d865d8fe3 Add test for multiple .dist-info in wheel 2019-12-21 10:51:57 -05: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
Pradyun Gedam 2db6f428bf
Update imports to {index -> index.package_finder} 2019-10-19 22:24:01 +05:30
Harsh Vardhan 4f1b88375a Skip running svn tests when svn isn't installed
Signed-off-by: Harsh Vardhan <harsh59v@gmail.com>
2019-10-14 14:32:32 +05:30
Pradyun Gedam 37bc629551
Rename tests.lib.path.Path.{abspath -> resolve()} 2019-10-07 18:01:06 +05:30
Pradyun Gedam 732da2dae0
Remove tests.lib.path.Path.__sub__ (#7151) 2019-10-07 17:52:19 +05:30
Pradyun Gedam 7d72b3e034
Update uses of path subtraction to os.path.relpath 2019-10-07 12:38:22 +05:30
Chris Hunt f805f328d4 Align interface of tests.lib.path.Path.mkdir with pathlib.Path.mkdir. 2019-10-06 21:55:10 -04:00
Pradyun Gedam 64262aacee
Use the repr of version strings in wheels. 2019-10-01 11:45:07 +05:30
Chris Hunt cf7ebdbbc2 Move PipSession to network.session 2019-09-27 01:02:52 -04:00
Pradyun Gedam ea68afab93
Enable isort in pre-commit 2019-09-24 18:03:22 +05:30