Commit Graph

42 Commits

Author SHA1 Message Date
Damian Shaw 68529081c2
Enforce f-strings via Ruff (#12393) 2023-11-07 09:14:56 +00: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 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
q0w 3166157e40 Opt to check build dependencies 2022-05-13 03:05:55 +03: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
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
Jon Dufresne c71cf88049 Complete type annotations of tests/functional/ directory 2021-11-18 18:26:17 -08: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 94999255d5
Reformat the codebase, with black 2021-08-20 13:37:49 +01:00
Taneli Hukkinen af79d0d393 Replace use of vendored `toml` in tests with PyPI `toml` 2021-07-02 00:21:00 +03:00
Stéphane Bidoul 7c6ee48b04 PEP 517 build in presence of --global-option emits a warning
So these are not ignored silently.
2021-04-04 16:08:49 +02:00
Stéphane Bidoul 69dee6286d PEP 517 + --build-option is now a warning
We warn instead of erroring out when --build-option is present
when doing a PEP 517 build. There is no strong reason to error
out, and this will avoid backward compatibility issues when we
support build options in requirement files and installation.
2021-04-04 16:08:49 +02:00
Andrey Bienkowski e4e9af1d27 Drop python2 related stuff in tests 2021-02-23 13:49:59 +03:00
Devesh Kumar Singh db11f83e2a Fix tests module with flake8-bugbear 2020-06-05 02:41:08 +05:30
Pradyun Gedam 78f16daa27
Switch pip's use of pytoml -> toml 2020-04-14 13:07:17 +05:30
Stéphane Bidoul 076d1a8ed8
Fix tests that build fake InstallRequirements with source_dir 2020-04-12 11:39:09 +02:00
Jason R. Coombs 3511d3d493 Convert the remaining '%' formatters to '.format'. Fixes #6973. 2020-03-06 12:43:03 -05:00
Chris Hunt dd8753cdee Mitigate Windows test failures due to PAX-format wheel release 2020-01-29 08:53:23 -05:00
Thomas Kluyver 400cf8d71e Add a test combining local PEP 517 backend with external dependency 2019-11-23 16:57:24 +00:00
Thomas Kluyver edc525add9 Remove leftover debugging code 2019-11-23 16:53:01 +00:00
Thomas Kluyver 81f6ba3fc1 Default None instead of [] 2019-11-23 16:52:24 +00:00
Thomas Kluyver dd7b1ee5c3 Fix building packages with backend-path in pyproject.toml
Closes gh-6599
2019-11-23 14:38:27 +00:00
Hanjun Kim 0363420239
update test condition 2019-11-12 20:03:01 +09: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 4b8f185fa8
Mark a network dependent test as network 2019-07-29 14:29:39 +05:30
Chris Hunt 39ac9ca351 Rename compatible functions in tests.lib.path.Path. 2019-07-02 18:48:44 -04:00
Chris Jerdonek 210dab7470 Add make_test_finder() helper function. 2019-06-11 19:18:56 -07:00
Chris Jerdonek cad71a7117 Add PackageFinder.create(), and simplify PackageFinder(). 2019-05-17 11:55:21 -07:00
Paul Moore 8b7c23d05c Make flake8 shut up 2019-02-27 18:04:50 +00:00
Paul Moore 1528d50902 Stupid typo 2019-02-27 17:50:42 +00:00
Paul Moore 9921442d1f Reject --build-options for PEP 517 builds 2019-02-27 17:40:52 +00:00
Nick Coghlan 682cff7230 Fix #6163: Default to setuptools.build_meta:__legacy__
The main setuptools PEP 517 backend is intended for
explicit usage in `pyproject.toml`, when the project
authors can ensure that their `setup.py` runs without
that directory being implicitly on `sys.path`.

For implicit usage, setuptools now offers a separate
legacy backend that more closely mimics direct
execution of the `setup.py` script.
2019-02-06 20:57:57 +10:00
Pradyun Gedam e55fcea956
Add tests for the bug 2019-01-23 09:48:04 +05:30
Benoit Pierre 817ef1a4cb add a couple of additional PEP 517 tests 2018-10-29 23:38:56 +01:00
Paul Moore f10be259ce PEP 517 tests 2018-10-29 23:33:21 +01:00
Benoit Pierre 744b8cf96e improve build environment
- check build requirements for conflicts
- better isolation (ignore system site packages)
- support 2 prefixes: a "normal" one, and an "overlay" one
  (with higher priority over "normal")
2018-10-29 23:17:51 +01:00
Paul Moore 4e018d76e2 Check for assumed requirements once the build environment is created 2018-08-02 20:08:04 +01:00
Paul Moore 8cdf6564fd Stop trying to lazy-load pyproject.toml, it isn't worth it. 2018-08-02 20:07:52 +01:00
Paul Moore 5503b89c6b Fix some test failures 2018-08-01 16:45:08 +01:00
Paul Moore 873bae7b44 Initial tests for PEP 517 backend calls 2018-08-01 16:15:11 +01:00