Commit Graph

85 Commits

Author SHA1 Message Date
Avasam
49ba409da8 Replace isort with Ruff (#10912) 2023-10-27 20:14:38 -07:00
Avasam
21fcd8960f Use Ruff for from __future__ import annotations checks (#10910) 2023-10-19 11:40:41 +02:00
Avasam
35873ec3d8 Doc: Use proper name capitalization of tooling (Ruff, Black, Flake8) (#10913) 2023-10-18 23:46:53 +01:00
Alex Waygood
487e33112e Bump various test dependencies (#10693) 2023-09-11 14:18:48 +01:00
Alex Waygood
f08b87ff18 Fix typechecking of our own test suite following change to dict.get (#10511) 2023-07-26 17:10:40 +01:00
Alex Waygood
2887f60196 Use ruff, not pycln, for removing unused imports (#10498) 2023-07-22 12:14:27 +01:00
Alex Waygood
79e092e133 Add some ruff autofixes to CI (#10458) 2023-07-20 14:41:52 +02:00
Sebastian Rittau
be925c0d3f Check that linters/type checkers are pinned to an exact version (#10311) 2023-06-12 20:12:14 +02:00
Sebastian Rittau
70d8d059a0 Make all tests executable (#10267) 2023-06-06 15:42:07 +02: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
Alex Waygood
60789273a2 Improve pyright verification of third-party test cases in CI (#9650)
Co-authored-by: Avasam <samuel.06@hotmail.com>
2023-02-07 11:53:54 +00:00
Alex Waygood
c216b74e39 Centralize METADATA.toml parsing in the test suite (#9534) 2023-01-28 15:13:46 +00:00
Alex Waygood
a4e3cfefac Improve pre-commit config (#9563)
- Add a few more hooks. These are all very fast, and I've found them useful in other projects:
  - Autofixes:
    - `trailing-whitespace`: fixes trailing whitespace
    - `requirements-txt-fixer`: alphabetises items in `requirements.txt` files
    - `end-of-file-fixer`: makes sure every file ends with a single newline character
    - `mixed-line-ending`: Makes sure Windows users don't accidentally introduce CRLF line endings into a file that uses LF line endings
  - None-autofixes:
    - `check-yaml`: loads YAML files to validate syntax
    - `check-toml`: loads TOML files to validate syntax
    - `check-merge-conflict`: detects merge-conflict strings in files and blocks them from accidentally being committed
    - `check-case-conflict`: checks for files with names that would conflict on a case-insensitive filesystem like MacOS HFS+ or Windows FAT; blocks them from being committed.
  - Change the bot schedule to quarterly, to reduce noisy PRs
  - Change the `black` language target-version to Python 3.10, synching the setting here with the changes that were made to our `pyproject.toml` file in #7538
2023-01-18 06:29:18 -08:00
Avasam
0e36622c72 Resolve stubtest allowlist entries for ldap3 (#9532) 2023-01-14 18:11:17 +00:00
Alex Waygood
ab1921a737 Teach isort that imports from utils are first-party imports (#9500) 2023-01-11 17:25:32 +01:00
Avasam
7c15e6998f Autoformat YAML files (#9450) 2023-01-03 08:55:06 +01:00
Nikita Sobolev
7806607df9 Improve error message of Unrecognised platforms specified (#9283) 2022-11-26 14:46:43 +01:00
Nikita Sobolev
bdf036d516 check_consistent.py: Add check ensuring packages are not installed for unspecified platforms (#9265) 2022-11-25 10:11:59 +00:00
Avasam
7050c1d907 Add support for Homebrew and Chocolatey (#9187) 2022-11-24 07:17:17 +00:00
Alex Waygood
01e78c7e81 Use modern syntax in test-case files where possible (#9261) 2022-11-23 11:58:11 -08:00
Sebastian Rittau
02942b710c Support "stub_distribution" and "upload" metadata fields (#9256) 2022-11-23 13:05:13 +01:00
Alex Waygood
4588dd6c74 check_consistent.py: Allow having weird filenames in the test_cases directory (#9239) 2022-11-21 17:40:11 +00:00
Alex Waygood
3fec65927c check_consistent.py: Add a check guarding against typos for the new platforms key (#9203) 2022-11-15 16:23:22 +00:00
Nikita Sobolev
9cd9f6f6e0 Add the ability to run third-party stubtest on Windows or MacOS when needed (#8923)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-11-11 13:40:50 +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
ab2fba9c83 check_consistent.py: ignore .gitignored files (#8804) 2022-09-28 17:02:27 +01: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
51e8325c10 Rename the files in the test_cases directory; add further clarifications to the README (#8688) 2022-09-06 07:50:24 +02:00
Alex Waygood
d91e5f0eff Further enhance check_consistent.py (#8604) 2022-08-26 07:50:26 -07:00
Shantanu
49062f53c3 Improve check_consistent (#8581)
- Use pathlib for convenience
- Share more logic between check_stubs and check_stdlib
- Better recursive checking, e.g. if a README.md is in the wrong place
- Fixes bug in checking directories in stubs/
- Test distribution names are valid
- Errors now contain full paths
- I believe pathlib normalises separators, but someone with Windows
  might want to double check this continues to work
2022-08-23 23:18:07 -07:00
Shantanu
19beaba9e7 Disallow adding stubs for types- packages (#8579)
This would lead to confusion. The types prefix is special cased in
various ways in stub_uploader
2022-08-20 15:44:17 -07:00
Kevin Kirsche
8c51fab4e2 Support extras in stubtest_third_party.py (#8467) 2022-08-18 14:12:36 -07:00
Shantanu
5ef20e8021 Use packaging to parse versions (#8314)
packaging is the standard tool for dealing with versions and
requirements. This allows us to easily support all PEP 508 specs.
packaging also has good error messages, so I don't create our own here.
This lets us get rid of our handrolled half parser and sanity checks.
I kept the whitespace consistency check, since that's just a formatting
lint and isn't testing the correctness of parsing (which we now
definitely do correctly).
2022-07-17 12:35:32 -07:00
Alex Waygood
78d96cd17e Drop support for Python 2 (#8272) 2022-07-12 09:08:56 +02:00
Shantanu
305f10b808 stubtest: per project --ignore-missing-stub (#8122) 2022-06-21 05:52:24 -07:00
Shantanu
64181e8dad stubtest: use separate table in METADATA.toml (#8096) 2022-06-19 00:43:24 -07:00
Sebastian Rittau
d8c0f25f0d Explain the no_longer_updated METADATA field (#8037) 2022-06-08 18:46:41 +02:00
Alex Waygood
9d450cb50c Make test scripts pass mypy --strict (#7745)
- Add several type hints to untyped functions.
- While we're at it, upgrade several annotations to use modern syntax by using `from __future__ import annotations`. This means that the tests can't be run on Python 3.6, but 3.6 is EOL, and it is already the case that some scripts in this directory can only be run on more recent Python versions. E.g. `check_new_syntax.py` uses `ast.unparse`, which is only available in Python 3.9+.
- Fix a few pieces of code that didn't type check.
2022-04-29 21:55:12 -06:00
Sebastian Rittau
f7aa41245e Drop Python 2 support in third-party stubs (#7703) 2022-04-27 15:32:17 +03:00
Sebastian Rittau
c3907ab26b Remove Python 2 support from some third-party distributions (#7466)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-03-09 20:19:22 +02:00
Sebastian Rittau
7a81bd41e9 Re-introduce the 'stubtest' key for third-party packages (#7351)
Some distributions can't be tested with stubtest for a variety of
reasons or because of bugs in stubtest. This key:

* let's us keep metadata about a distribution in one place,
* prevents us from modifying the scripts because of issues with a
  specific distribution, and
* will trigger tests if only the key is changed.
2022-02-22 15:59:27 +01:00
Sebastian Rittau
38811a4495 Fix check consistent (#6860) 2022-01-08 15:35:42 +02:00
Sebastian Rittau
14e5d16c3a Replace METADATA stubtest key with stubtest_apt_packages (#6704) 2021-12-27 17:28:59 +01:00
Sebastian Rittau
bb77f39b7c Add a 'stubtest' flag to METADATA.toml (#6687)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-12-25 17:02:57 +02:00
Shantanu
c47ed98b3e dummy_thread/ing: remove in 3.9 (#6408)
https://bugs.python.org/issue37312
2021-11-27 20:50:14 -08:00
Sebastian Rittau
bb24e77404 Update remaining versions for third-party stubs (#6094)
Also remove the python2 markers of packages that don't list Python 2
as supported in the latest version.

Don't special case version '0.1'

Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-10-12 12:30:45 +02:00
Sebastian Rittau
46fc031ee7 Allow third-party versions to end in asterisk (#6129)
This is a first step towards #6095, where x.y and x.y.* are treated as
equivalent. The next step is to update existing versions to use x.y.*
where applicable and then treat x.y differently.

Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-10-11 00:46:18 +02:00
Sebastian Rittau
0506182348 Allow three-component third-party versions (#5995)
Closes: #5992
2021-09-18 20:08:51 -07:00
Nikita Sobolev
392c81d767 Switch from toml to tomli (#6023) 2021-09-10 15:48:15 +02:00