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

31 commits

Author SHA1 Message Date
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
Jon Dufresne
60c274be2d Complete type annotations of tests/unit/ directory 2021-09-23 05:44:54 -07:00
Pradyun Gedam
94999255d5
Reformat the codebase, with black 2021-08-20 13:37:49 +01:00
Jon Dufresne
ea576933b9 Remove str_to_display/console_to_str in favor of subprocess decoding
Since Python 3.6, subprocess supports decoding stdout and stderr. Like
before, decoding errors are handled using "backslashreplace".

One difference: In the event of a decoding error, pip previously logged
a warning before trying again with "backslashreplace". Subprocess does
not log such a warning.
2021-02-20 06:04:01 -08:00
Jon Dufresne
cd9a0dd26d Simplify str_to_display() and its uses
With Python 2 dropped, only bytes need to be handled. Passing str was a
nop. These bytes/str boundaries are much clearer now.

There remains one use of str_to_display(): constole_to_str(). It
converts subprocess bytes output to str while handling decoding errors.
2021-02-20 06:02:26 -08:00
Jon Dufresne
5150129f6b Replace compat.expanduser() with os.path.expanduser()
The upstream bug has been fixed and released in all supported Python
version: https://bugs.python.org/issue14768
2020-12-29 08:15:55 -08: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
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
05bdc69aa3 Make test more explicit 2020-07-17 14:33:19 +07:00
cb8d81d135 Nitpick logging calls 2020-07-17 14:33:19 +07: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
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
Chris Hunt
0a6305a398 Remove unused compat.native_str 2019-11-10 18:06:24 -05:00
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
537b0fca12
Change isort multi_line_output to 3 2019-07-22 10:15:27 +05:30
Chris Jerdonek
0d5a98390e
Merge pull request #6671 from cjerdonek/make-subprocess-error-non-ascii-cmd
Handle non-ascii commands in Python 2 in make_subprocess_output_error()
2019-07-04 15:43:25 -07:00
Chris Jerdonek
a6020e8553 Handle non-ascii commands in Python 2 in make_subprocess_output_error(). 2019-07-04 00:54:15 -07:00
Chris Hunt
39ac9ca351 Rename compatible functions in tests.lib.path.Path. 2019-07-02 18:48:44 -04:00
Pradyun Gedam
4fc697847a
Update imports for the moved compat module 2018-07-29 18:32:20 +05:30
Jon Dufresne
9c4bd6d5eb Update doc and comment URLs to https where available 2018-06-13 09:00:42 -07:00
Pradyun Gedam
729990c986
Round 1 of Cleanups (#4844)
* misc: fix typo
* misc: 🎨 cleanup parenthesis
* misc: 🎨 minor simplifications
* tests: fix test_console_to_str_warning
2017-12-25 15:23:27 +05:30
Pradyun Gedam
353a13ddff
isort: Include trailing commas 2017-11-21 13:23:59 +05:30
Donald Stufft
95bcf8c5f6 Move all internal APIs to pip._internal 2017-08-31 14:53:00 -04:00
Pradyun S. Gedam
9923c1ad7e Sort imports and minor Flake8 changes (#4520)
* Run isort on the codebase

Command: isort --recursive --skip __main__.py --skip _vendor -o pip._vendor -sd THIRDPARTY -m 5 -p pip -p tests ./pip ./tests

* 📰
2017-06-13 14:17:00 +02:00
Paul Moore
8a101321f6 Another attempt to fix encoding issues (#4486)
When reading bytes from subprocesses, use the locale encoding. Don't fail if the data is encoded incorrectly - instead, use the backslashreplace error handler (and warn the user).
2017-05-27 22:02:08 +01:00
Pradyun S. Gedam
1832569530 Sort all imports 2017-05-16 15:47:47 +05:30
Paul Moore
1f2d639029 Skip a couple of tests that fail on Windows 2016-09-01 19:59:07 +01:00
Andy Freeland
73a439ea66 Add pip.compat.expanduser to workaround http://bugs.python.org/issue14768 2015-09-29 16:01:32 -04:00
Remi Rampin
48584f0de7 Adds test for native_str() 2014-09-01 21:47:04 -04:00
Matthew Iversen
dcb0ee0702 Move backwardcompat package to compat module 2014-05-14 13:10:06 +10:00
Renamed from tests/unit/test_backwardcompat.py (Browse further)