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

335 commits

Author SHA1 Message Date
Stéphane Bidoul
58d8dc28cb
Do not fail tests on our own deprecation warnings 2022-08-05 09:35:00 +02:00
Stéphane Bidoul
b423c07ff4
Detected indented ERROR and WARNING messages in tests 2022-08-05 09:35:00 +02:00
Paul Moore
662f940c96 Merge branch 'main' into test_zipapp 2022-07-28 10:51:04 +01:00
Stéphane Bidoul
bb2a3d7410
Remove the html5lib deprecated feature flag. 2022-07-16 19:37:11 +02:00
Paul Moore
ea2318fbf9 Minor zipapp-related fixes and skips for some tests 2022-07-12 10:12:17 +01:00
Paul Moore
c7e7e426cb Apply black 2022-07-12 09:02:11 +01:00
Paul Moore
ef999f4c76 Ignore temporary extracted copies of cacert.pem when testing with a zipapp 2022-07-11 17:18:21 +01:00
Paul Moore
a57668ef12 Add an option to the test suite to specify a zipapp to test 2022-07-11 16:26:24 +01:00
Stéphane Bidoul
25dd00571a
Merge pull request #11022 from SpecLad/download-propagate-pep517
pip download: make sure that --use-pep517 is propagated to the dependencies
2022-06-24 19:42:58 +02:00
q0w
c8c88ce520 Adapt tests 2022-06-23 19:20:18 +03:00
q0w
49657d8c94 Use os.fspath 2022-06-21 19:35:22 +03:00
q0w
3181063f94 Convert to str shutil.move src arg for py<=39
https://github.com/python/cpython/issues/76870
2022-06-15 22:07:15 +03:00
Роман Донченко
28d7730087 test_download_use_pep517_propagation: use a different approach
The approach it uses now doesn't work anymore due to 452d7da8.
The installation of `fake_dep` now succeeds whether or not `setuptools`
is installed in the test environment.

Use a different approach instead: try to import `pip` in the `setup.py`
script. If it succeeds, then we are not running in an isolated environment,
and therefore PEP 517 isn't being used.

To add this custom logic to `setup.py`, add a new argument to
`create_basic_sdist_for_package`. Note that to make this work, I had to
switch from f-strings to `str.format`, since the `dedent` has to happen
before formatting.
2022-06-15 18:11:07 +03:00
Роман Донченко
698784796b pip download: make sure that --use-pep517 is propagated to the dependencies 2022-06-15 18:10:22 +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
428e886ad6
Drop out-of-tree/in-tree build transition flags
These were intended to help users transition when the default behaviour
changed to no longer perform out-of-tree builds. The transition is now
considered complete.
2022-04-08 12:20:36 +01:00
Pradyun Gedam
afda75625c
Present the result, when the script passes unexpectedly 2022-02-26 12:32:53 +00:00
Jon Dufresne
bf5f4008e7
Replace vendored html5lib with stdlib
The html5lib library isn't strictly required as the same functionality
can be achieved through the stdlib html.parser module.

The html5lib is one of the largest uses of the six library. By dropping
this unnecessary dependency, the pip project is closer to dropping the
six library.

Additionally, html5lib maintenance has slowed down and the project has
rejected pull requests to drop Python 2 support.

For now, the html5lib code remains, but is gated behind a command
line option: `--use-deprecated=html5lib`. After a sufficient amount of
time has passed without any reported bugs, the vendored library and this
flag can be removed completely.
2022-01-28 06:45:57 +00:00
Pradyun Gedam
8eeee22304
Abort immediately on metadata generation failure instead of backtracking
This behaviour is more forgiving when a source distribution cannot be
installed (eg: due to missing build dependencies or platform
incompatibility) and favours early eager failures instead of trying to
ensure that a package is installed regardless of the amount of effort it
takes.
2022-01-27 18:11:02 +00:00
James Gerity
5c24a798b8
Change VCS tooling verbosity along with pip's verbosity (#9639)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2022-01-25 08:54:02 +00:00
Pradyun Gedam
ff8b9a167e
Mark TestPipResult as not having tests
This makes pytest stop warning about it.
2022-01-21 14:10:40 +00:00
Tzu-ping Chung
1181b22119 Apply mypy config override to blocked_signals 2021-11-22 17:05:15 +08:00
Tzu-ping Chung
7d27b9c412 Fix various typing errors on Windows 2021-11-22 15:55:31 +08:00
Jon Dufresne
c71cf88049 Complete type annotations of tests/functional/ directory 2021-11-18 18:26:17 -08:00
Jon Dufresne
72937f6520 Complete type annotations for tests/conftest.py and tests/lib/* 2021-09-29 19:57:29 -07:00
Tzu-ping Chung
d91fecdb5a
Merge pull request #10436 from jdufresne/fixture-data
Set TestData.__test__ to False to avoid pytest discovery
2021-09-28 21:50:37 +08:00
Tzu-ping Chung
b392833a0f
Merge pull request #10435 from jdufresne/typing-unit 2021-09-26 16:29:29 +08:00
Jon Dufresne
e1acf245a9 Handle PY2 TODO comment in tests/lib/filesystem.py 2021-09-25 07:38:09 -07:00
Jon Dufresne
60c274be2d Complete type annotations of tests/unit/ directory 2021-09-23 05:44:54 -07:00
Stéphane Bidoul
cee422f5bc
Refactor direct_url test helper 2021-09-21 11:18:00 +02:00
Jon Dufresne
8b24a66aa1 Set TestData.__test__ to False to avoid pytest discovery
As the class name starts with "Test", pytest interprets it as a test
case, but it is not one. Further, due to its `__init__` method, pytest
emits the following warning:

    .../pip/tests/lib/__init__.py:141: PytestCollectionWarning: cannot
    collect test class 'TestData' because it has a __init__ constructor

For additional information on pytest discovery, see:
https://docs.pytest.org/en/latest/example/pythoncollection.html
2021-09-05 13:51:46 -07:00
Jon Dufresne
9e88e8708f Replace assert_raises_regexp function with pytest.raises
These methods serve the same purpose. Can shift to using the upstream
implementation.

https://docs.pytest.org/en/latest/reference/reference.html#pytest.raises
2021-08-29 07:09:50 -07:00
Jon Dufresne
20d8d0bfe4 Remove unused method ConfigurationMixin.get_file_contents()
Unused since its introduction in
f9990605dc.
2021-08-28 09:21:53 -07:00
Pradyun Gedam
8899c25796
Merge pull request #10396 from jdufresne/more-test-mypy
Complete typing of some tests/lib/* files
2021-08-28 08:13:18 +01:00
Stéphane Bidoul
7aaea4e218
Merge pull request #10401 from jdufresne/files-to-clear
Remove unused ConfigurationMixin._files_to_clear
2021-08-27 19:52:46 +02:00
Jon Dufresne
34a3838b73 Complete typing of some tests/lib/* files 2021-08-27 09:25:22 -07:00
Jon Dufresne
d4a2f89fd1 Remove unused argument run_from from PipTestEnvironment.run() 2021-08-26 18:55:52 -07:00
Jon Dufresne
8271a5e288 Remove unused ConfigurationMixin._files_to_clear
The list is always empty.

Removing the unused attributes simplifies the mixin and avoids the need
to add a type annotation for it.

Unused since its introduction in
bd850c0798.
2021-08-26 11:59:03 -07:00
Tzu-ping Chung
135faabfd6
Remove direct pkg_resource usages from resolver and preparer 2021-08-23 02:07:33 +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
Jon Dufresne
d144fd960c Cleanup several Python 2 version_info checks/workarounds 2021-08-20 09:39:31 -06:00
Jon Dufresne
6a6561c2cb Move many type comments to annotations
Use the tool com2ann to automatically convert most type comments to type
annotations. Some type comments continue to exist where any work beyond
the automatic conversion was required (for example, additional
formatting or circular references).

For additional information on the com2ann tool, see:
https://github.com/ilevkivskyi/com2ann
2021-08-10 07:12:32 -07:00
Pradyun Gedam
4d933d2e10
Use a stricter regex for matching the Python version
Co-authored-by: Kevin Puetz <puetzk@puetzk.org>
2021-08-06 15:55:55 +01:00
Pradyun Gedam
35b938b42e
Permit multi-character segments in Python versions, in a test
This is necessary since Python 3.10 has two digits in the minor version.
2021-08-06 13:42:31 +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
e6c317769a Move assert_[not_]installed to Script and use it
This help function is much better than the previous ad-hoc logic used in
test_uninstall.py, which has trouble identifying normalized names.
2021-07-12 11:44:23 +08:00
Tzu-ping Chung
a31f8fd5ed Add failed test case 2021-04-19 08:31:28 +08:00
Paul Moore
cc3adad1b2 Don't use virtualenv internals in tests 2021-04-05 13:16:26 +01:00
Pradyun Gedam
37ad296684
Tweak textwrap.dedent strings 2021-04-02 12:00:01 +01:00
Pradyun Gedam
ebb80861ee
Blacken tests/lib 2021-04-02 11:59:57 +01:00