Commit Graph

6 Commits

Author SHA1 Message Date
Tzu-ping Chung b850d539f9 Keep using old virtualenv for Python < 3.10
pip uses distutils (instead of sysconfig) for Python < 3.10, which has
awkward path issues when faking a user site.
2022-10-28 01:51:13 +08:00
Tzu-ping Chung f96ba08dbc Bump virtualenv to 20+ in tests 2022-10-28 01:51:13 +08:00
Stéphane Bidoul 3f5436cf3d
Use installer instead of setuptools in test suite
Instead of using a private setuptools api to
install common wheels in "editable" mode,
use 'installer' together with a .pth.
2022-07-23 16:22:02 +02: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
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 236c0ccb8a
Move test requirements into tests/
This makes the file easier to locate, by placing it next to the stuff
that it will affect.
2021-07-24 12:06:51 +01:00
Renamed from tools/requirements/tests.txt (Browse further)