Commit Graph

121 Commits

Author SHA1 Message Date
Sebastian Rittau
822fae31e5 Remove Python 3.8 from CI (#13387) 2025-01-10 14:15:39 +01:00
Avasam
9c959a7dd3 Enable Ruff D (pydocstyle) with pep257 convention (#13326)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-02 22:05:35 +00:00
Sebastian Rittau
2d0f6d8277 Bundle path handling in ts_utils.paths (#12805) 2024-10-17 08:16:10 +02:00
Sebastian Rittau
1fa4986f71 Move common utility functions to a common library (#12773) 2024-10-14 08:00:02 +02:00
Sebastian Rittau
3b385903a1 Pass Requirement objects around (#12709)
This allows us to keep metadata like python_version and platform_system
and use it to conditionally install packages.
2024-09-30 17:45:58 +02:00
Jan Kühle
d326c9bd42 Filter pytype tests by stdlib/VERSIONS file (#12649)
Filter the files to run pytype tests on by stdlib/VERSIONS file. This
becomes important for Python 3.12, where e.g. checking asynchat.pyi
requires asyncore.pyi, both of which have been removed in 3.12.
2024-09-12 18:40:19 +02:00
Sebastian Rittau
cc40120ee5 mypy_test: Exclude sub-modules not in current Py version (#12352) 2024-07-16 16:04:54 +02:00
Sebastian Rittau
f0afb04395 Extract VERSIONS parsing to _utils.py (#12351) 2024-07-16 12:51:15 +02:00
Ali Hamdan
e285e52e13 mypy_test.py: warn about incompatible python version only on tested files (#12079) 2024-06-01 17:51:57 +01:00
Sebastian Rittau
425c69a6b9 Prefix utility modules with underscore (#11999) 2024-05-22 09:35:11 -04:00
Alex Waygood
b8d144d491 Add 3.13 to our CI (#11926) 2024-05-19 16:18:49 -04:00
Sebastian Rittau
392ae934fc Move test_cases to stdlib/@tests/test_cases (#11865) 2024-05-09 19:27:09 -07:00
Alex Waygood
2c5712b7f4 Use uv for installing dynamic dependencies in mypy_test.py and regr_test.py (#11517) 2024-03-02 08:38:34 +00:00
Avasam
da69247514 Code improvements from new Ruff checks (#11498) 2024-02-28 22:30:18 -08:00
Nikita Sobolev
06d0151b25 Enable redundant-self mypy error code (#11056) 2023-11-22 10:13:17 +00:00
Nikita Sobolev
d232def6b2 Use consistent mypy output spacing (#11055) 2023-11-22 09:58:13 +00:00
Sebastian Rittau
7e2a3413fa Fix mypy_test if mypy returns negative exit code (#10866) 2023-10-11 14:53:16 +02:00
Ali Hamdan
c5dde1e720 Add optional requires_python field to third-party stubs metadata (#10724)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-09-24 18:39:12 +01:00
Alex Waygood
ef758b66c0 Bump mypy to 1.5.1 (#10559) 2023-08-16 12:18:31 -07:00
Sebastian Rittau
70d8d059a0 Make all tests executable (#10267) 2023-06-06 15:42:07 +02:00
Alex Waygood
2c3449694b Run mypy and pyright on our py312 stubs in CI (#10119) 2023-04-30 15:31:08 +01:00
Avasam
75f47d0cb1 Typecheck typeshed's code with pyright (#9793)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-02-22 18:53:07 +00:00
Avasam
140bba3425 Add comments when subclassing Any (#9732) 2023-02-14 14:11:56 +01:00
Alex Waygood
c216b74e39 Centralize METADATA.toml parsing in the test suite (#9534) 2023-01-28 15:13:46 +00:00
Alex Waygood
3d6b8dccfe mypy_test.py: Try using a process pool instead of a thread pool (#9556) 2023-01-17 14:17:45 +00:00
Avasam
1a9aa3f3fe Update various comments now non-types dependencies are allowed (#9527) 2023-01-14 13:20:04 +00:00
Alex Waygood
0b903441e8 Allow stubs to depend on numpy (#9499) 2023-01-12 09:01:23 +00:00
Alex Waygood
ab1921a737 Teach isort that imports from utils are first-party imports (#9500) 2023-01-11 17:25:32 +01:00
Alex Waygood
9aa3d99ac2 mypy_test.py: Add more comments (#9477)
Some fairly subtle logic was added in #9408, and I'm immediately regretting not having documented it slightly better. This PR adds some more comments to make maintaining this code easier in the future.
2023-01-08 12:26:11 -08:00
Alex Waygood
910397c714 mypy_test.py: Simplify add_third_party_files() (#9476) 2023-01-08 12:25:06 -08:00
Alex Waygood
4d6fda99f0 mypy_test.py: Allow non-types dependencies (#9408)
The approach is pretty similar to the approach I took in #9382 for regr_test.py: dynamically create virtual environments for testing stubs packages in isolation. However, since mypy_test.py tests all of typeshed's stubs in succession (and since lots of typeshed's stubs packages depend on other typeshed stubs packages), the performance issues with creating a virtual environment for testing each stubs package are even more severe than with regr_test.py.

I mitigate the performance issues associated with dynamically creating virtual environments in two ways:

- Dynamically creating venvs is mostly slow due to I/O bottlenecks. Creating the virtual environments can be sped up dramatically by creating them concurrently in a threadpool. The same goes for pip installing the requirements into the venvs -- though unfortunately, we have to use pip with --no-cache-dir, as the pip cache gets easily corrupted if you try to do concurrent reads and writes to the pip cache.

- If types-pycocotools requires numpy>=1 and types-D3DShot also requires numpy>=1 (for example), there's no need to create 2 virtual environments. The same requirements have been specified, so they can share a virtual environment between them. This means we don't have to create nearly so many virtual environments.
2023-01-07 23:57:49 +00:00
Alex Waygood
8671fc5c0f regr_test.py: Allow non-types dependencies (#9382) 2022-12-23 13:55:54 -08:00
Avasam
c6b9b4ce85 Stricter settings in mypy_test (#9294) 2022-12-02 18:55:55 +00:00
github-actions[bot]
5453c97753 Bump protobuf to 4.21.*; delete google/__init__.pyi (#8360)
This major version bump of the stubs package deletes google/__init__.py, which does not exist at runtime, and caused problems for several users. Mypy now has --namespace-packages enabled by default, which should hopefully mean that this causes minimal pain.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-11-25 11:28:56 +00:00
Samuel T
573ee94f35 All scripts/tests: always specify file encoding in calls to open() (#8882) 2022-10-11 22:29:36 +01:00
Alex Waygood
e73fcf220e mypy_test.py: Remove unused seen variable/parameters (#8846) 2022-10-04 14:38:31 -07:00
Alex Waygood
55cddc7ac7 mypy_test.py: restore previous behaviour where all third-party stubs are tested by default (#8842) 2022-10-04 11:01:51 -07:00
Alex Waygood
5da171ba45 mypy_test.py: Always add dependencies of stubs to the files to test (#8800) 2022-10-04 08:05:13 -07:00
Alex Waygood
ab2fba9c83 check_consistent.py: ignore .gitignored files (#8804) 2022-09-28 17:02:27 +01:00
Alex Waygood
48e76e8a56 Bump mypy to 0.981 (#8796) 2022-09-26 17:14:33 -07:00
Alex Waygood
008fe2e764 mypy_test.py: rework filter, exclude and --dir arguments (#8711) 2022-09-22 08:31:24 +01:00
Alex Waygood
b53843ab46 Add infrastructure allowing for test cases for third-party stubs (#8700)
- Move the logic for running mypy on the test cases from `tests/mypy_test.py` to a separate script, `tests/regr_test.py`.
- Add the necessary logic in order to be able to have test cases for third-party stubs.
- Move logic common to `tests/mypy_test.py` and `tests/regr_test.py` into `tests/colors.py`, and rename `tests/colors.py` to `tests/utils.py`.
- Add a new check to `tests/check_consistent.py`, to enforce the use of `# pyright: reportUnnecessaryTypeIgnoreComment=true` comments in third-party test cases. These are essential if we want to have our tests against false-negatives work with pyright.
- Update the relevant documentation to account for the new test file.
- Add a new job to the `tests.yml` GitHub workflow, to run the new test in CI.
- Add a simple proof-of-concept test case for `requests`, as a regression test for #7998.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2022-09-08 16:51:33 +01:00
Alex Waygood
b6d28acb23 mypy_test.py: Use pathlib more (#8680) 2022-09-05 14:24:14 +01:00
Alex Waygood
1c56148ce9 mypy_test.py: Remove --dry-run option (#8611)
Cf #8139.
2022-08-25 14:23:00 +02:00
Nipunn Koorapati
c697a51378 Support tests/mypy_test.py [package] (#8610)
Currently, the testsuite early exits if it's filtering on a single
package. With this change, it will correctly complete.

For example `tests/mypy_test.py protobuf`
2022-08-25 12:25:26 +01:00
Alex Waygood
875f0ca7fc mypy_test.py: Move type-checking of our tests and scripts into a different test (#8587) 2022-08-22 17:16:03 +01:00
Alex Waygood
38bc0ec0e6 mypy_test.py: simplify argument parsing (#8577) 2022-08-20 21:32:17 +01:00
Kevin Kirsche
bd7a02fad4 refactor: prefer f-strings to other format/concatentation styles (#8474) 2022-08-03 14:04:27 +02:00
Sebastian Rittau
ef443b6359 Re-enable SQLAlchemy mypy tests (#8282)
These used to crash if run twice in succession locally, but the crash has been fixed on mypy 0.971
2022-07-19 16:46:39 +01:00
Alex Waygood
78d96cd17e Drop support for Python 2 (#8272) 2022-07-12 09:08:56 +02:00