Commit Graph

154 Commits

Author SHA1 Message Date
Damian Shaw 68529081c2
Enforce f-strings via Ruff (#12393) 2023-11-07 09:14:56 +00:00
hauntsaninja 666be3544b Avoid use of 2020-resolver and legacy-resolver 2023-09-23 13:34:06 -07:00
q0w 110a26f0ed Merge branch 'main' into per-req-config-settings 2023-04-09 18:12:41 +03:00
Stéphane Bidoul 64967c7907 Fix test_install_requirements_with_options
This test depended on setup.py install, and tbh, I don't see a good
reason to attempt an install when testing the requirements file parser.
2023-03-31 09:47:09 +02:00
q0w 13459a809b
Merge branch 'main' into per-req-config-settings 2023-03-30 11:18:31 +03:00
Pradyun Gedam 78ab4cf071
Bump all linters other than mypy (#11901) 2023-03-27 20:03:11 +01:00
q0w 69cfd23c17 Merge branch 'main' into per-req-config-settings 2023-03-20 07:26:21 +03:00
Stéphane Bidoul a04748db8e Remove support for the deprecated --install-options 2023-03-18 11:20:51 +01:00
q0w 227fe23b0e Add per-requirement --config-settings 2022-12-05 08:05:26 +03:00
Pradyun Gedam 6421ab59d5
Remove the opt-in for `2020-resolver`
This has been the default for quite some time now.
2022-10-07 11:57:02 +01:00
Paul Moore fe78726b36
Merge pull request #11492 from ret2libc/raise-file-parse-error-no-valueerr
Raise RequirementsFileParseError when missing closing quotation
2022-10-06 14:31:16 +01:00
Riccardo Schirone 3ca52dc55c Raise RequirementsFileParseError when missing closing quotation
shlex.split, used to split options in requirements.txt files, might
raise a ValueError when the input string is not well formed. Catch the
ValueError and re-raise it as a RequirementsFileParseError instead.
2022-10-06 14:36:46 +02:00
Stéphane Bidoul 65641f10ad
Fix test_install_requirements_with_options 2022-09-25 11:21:36 +02: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
hauntsaninja edbfeae9fb fix tests 2022-08-12 19:01:26 -07:00
Klaas van Schelven 2ec5097281 Add a test for 'respect --no-index'
See #11276
2022-07-27 11:49:06 +02: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
Jon Dufresne 60c274be2d Complete type annotations of tests/unit/ directory 2021-09-23 05:44:54 -07:00
Jon Dufresne 09450dd052 Add missing "session" fixtures in tests/unit/test_req_file.py
Caught by mypy:

    tests/unit/test_req_file.py:342: error: Argument "session" to "parse_reqfile"
    has incompatible type "Callable[[], PipSession]"; expected "PipSession"
    [arg-type]
        ...  reqs = list(parse_reqfile("./parent/req_file.txt", session=session))
                                                                        ^
2021-09-20 21:38:16 -07:00
Pradyun Gedam b8fc219418
Merge pull request #10429 from jdufresne/pretend
Replace use of pretend library with unitest.mock in tests
2021-09-04 21:04:34 +01:00
Jon Dufresne 3047bbadb2 Remove unused monkeypatch fixtures in tests 2021-09-04 08:37:05 -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
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 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 f6b184ccaf
Strip slash before Windows drive letter in path (#10116)
Functions like urllib.parse.urlsplit() parses a file:// URL created from
a non-UNC Windows absolute path with a leading slash in the path
component:

>>> from pathlib import Path
>>> from urllib.parse import urlsplit
>>> path = Path("C:/Users/VssAdministrator")
>>> parsed = urlsplit(path.as_posix())
>>> parsed.path
'/C:/Users/VssAdministrator'

This value unfortunately does not play well with path functions like
open(), so we performs some additional cleanup to strip that leading
slash.

This commit also contains some minor cleanup to unify how Windows is
detected, and how a file:// URL is fetched.
2021-07-22 15:28:43 +08:00
Alex Gaynor 248b6785a4 Added comments 2021-05-17 17:15:27 -04:00
Alex Gaynor f787788a65 Include rustc version in the user agent, if rustc is available
Rust is becoming more popular for writing Python extension modules in, this information would be valuable for package maintainers to assess the ecosystem, in the same way glibc or openssl version is.
2021-05-16 21:50:58 -04:00
Pradyun Gedam c2ba7c043b
Merge pull request #9606 from hexagonrecursion/fstr 2021-02-21 08:30:00 +00:00
Andrey Bienkowski e494e3748d Apply review suggestion 2021-02-20 20:50:18 +03:00
Andrey Bienkowski 9b2cb894ba Convert more str.format() calls to f-strings 2021-02-13 09:27:17 +03: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
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
Hugo van Kemenade 817ee23051 Remove redundant Python 2.7 code 2020-12-22 09:06:26 +02:00
Pradyun Gedam 58c594c06b
Prepare isort for black 2020-09-23 21:47:47 +05:30
Noah Gorny aae63795b2 reqfile: Update extra-index-url/index-url in session from requirements file
Also update the relevant tests
2020-08-06 19:25:31 +03: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
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
Devesh Kumar Singh bd70025c98 Remove --always-unzip based tests 2020-06-25 16:52:15 +05:30
Devesh Kumar Singh db11f83e2a Fix tests module with flake8-bugbear 2020-06-05 02:41:08 +05:30
Pradyun Gedam 5e4c3565e4
Update tests, didn't directly reference "regex" 2020-04-20 22:58:10 +05:30
Pradyun Gedam 7e61569b1a
Drop --skip-requirements-regex 2020-04-20 22:37:25 +05:30
Noah Gorny c936ed0165 session: Rename _insecure_adapter to _trusted_host_adapter
Currently it is just the insecure adapter, but this can change in the future
2020-03-26 21:15:38 +02:00
Jason R. Coombs 6282a307dc 👹 Feed the hobgoblins (delint). 2020-03-06 12:43:10 -05:00
Jason R. Coombs 3511d3d493 Convert the remaining '%' formatters to '.format'. Fixes #6973. 2020-03-06 12:43:03 -05:00
Christopher Hunt 40523794d8
Merge pull request #7747 from pfmoore/parsed_requirement
Refactor parse_requirements to be independent of InstallRequirement
2020-02-24 00:21:28 +08:00
Anudit Nagar 082c0f01d2
Update old-style formatting to new-style formatting (#7762) 2020-02-21 21:48:14 +05:30