Commit Graph

848 Commits

Author SHA1 Message Date
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
Avasam
70025c3723 Support third-party stub external dependencies in pytype (#9449)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-01-04 19:32:23 +00:00
Avasam
3e24c65c3b Rework how pyright is run in CI to allow for non-types dependencies(#9434)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-01-03 22:43:56 +00:00
Avasam
7c15e6998f Autoformat YAML files (#9450) 2023-01-03 08:55:06 +01:00
Avasam
0edcfa13ad Add syntax highlight to all shell code blocks (#9445) 2023-01-02 23:55:25 +00:00
Alex Waygood
a7f1d3c08d Improve mypy flags for regr_test.py and typecheck_typeshed.py (#9441)
- Remove redundant flags that are now enabled by default
- Add `--pretty` to `typecheck_typeshed.py`
2023-01-02 12:01:44 +00:00
Avasam
46f0d918ef A more accurate termcolor.colored fallback (#9435) 2022-12-31 22:52:26 +00:00
hamdanal
6c32486971 pytype_test.py: fix f-string missing “f” (#9430) 2022-12-31 10:07:02 +00:00
Alex Waygood
fd3e64ac3e regr_test.py: Fix out-of-date comment (#9419) 2022-12-27 17:26:48 +00:00
Alex Waygood
8671fc5c0f regr_test.py: Allow non-types dependencies (#9382) 2022-12-23 13:55:54 -08:00
Alex Waygood
352f496d69 Unpin stubtest from Python 3.10.8 and 3.11.0 (#9368) 2022-12-20 20:31:13 +00:00
hamdanal
3592dba338 Stubtest_third_party.py: better error message if ensurepip isn't available 2022-12-18 12:05:31 +00:00
Alex Waygood
c78bc57f78 shutil.rmtree: add avoids_symlink_attacks attribute (#9366) 2022-12-15 09:56:58 +00:00
Jelle Zijlstra
388d7839d9 regr_test.py: improve interaction between --all and --quiet flags (#9349)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-12-10 21:39:33 +00:00
Ilya Konstantinov
578cebe1c5 protobuf: Annotate well_known_types.pyi (#9323)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-12-05 18:49:55 +00:00
Avasam
c6b9b4ce85 Stricter settings in mypy_test (#9294) 2022-12-02 18:55:55 +00:00
Nikita Sobolev
bc1da6a748 Remove unused code from pytype_test.py (#9317) 2022-12-02 18:33:24 +00:00
Avasam
5c3f10e1df Deduplicate pinned pyright version (#9299)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-11-30 08:52:55 +00:00
Nikita Sobolev
7806607df9 Improve error message of Unrecognised platforms specified (#9283) 2022-11-26 14:46:43 +01:00
Avasam
087917f2b8 Space out pytype errors (#9281) 2022-11-26 01:32:08 +01:00
Alex Waygood
95c74ba7e1 Minor improvements to tests/regr_test.py (#9274) 2022-11-25 15:03:20 +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
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
Nikita Sobolev
bd75ceb0b6 Fix stdlib stubtest failures on main (#9255)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-11-23 10:07:05 +00: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
1f8491d23d Allow adding test cases testing version-dependent Python features (#9238) 2022-11-21 08:03:28 -08: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
Avasam
72d1597de2 stubtest_third_party.py: Allow running non-listed platforms locally (#9173)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-11-15 01:39:57 +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
Alex Waygood
cc7ac01a3e Stubtest: Don't allowlist termios and posix constants on Windows (#9150) 2022-11-10 07:02:53 -08:00
Nikita Sobolev
805519717b regr_test.py: fix typo in --help (#9147)
It used to be:

```
  -p [{3.11,3.10,3.9,3.8,3.7} ...], --python-version [{3.11,3.10,3.9,3.8,3.7} ...]
                        Run mypy for certain Python versions (defaults to
                        sys.version_info[:2])Note that this cannot be specified if
                        --all is also specified.
```
2022-11-10 13:32:22 +00:00
Samuel T
796bdc2eb0 Improve accuracy of six byte index methods (#9117) 2022-11-09 19:22:33 -08:00
Alex Waygood
4f381af4c5 Upgrade mypy to 0.990 (#9123) 2022-11-07 11:20:47 -08:00
Nikita Sobolev
86f9d93003 Update pyright to 1.1.278 (#9077)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-11-03 15:32:10 +00:00
Jelle Zijlstra
6b702452b6 http: improve types (#9055) 2022-11-03 09:55:56 +01:00
Jelle Zijlstra
3d8d744eb4 ctypes: improve bytes handling (#9029) 2022-10-31 15:26:09 +01:00
Nikita Sobolev
fd75bc21fc Use 3.11 instead of 3.11-dev (#8983) 2022-10-26 15:52:24 +02:00
Sebastian Rittau
b2d6d3c935 Update distutils stubtest allowlists for Python 3.11 release (#8985)
Closes: #8984
2022-10-26 00:18:09 +02:00
Nikita Sobolev
09511fd72f print cannot raise subprocess.CalledProcessError (#8933) 2022-10-19 19:16:05 +01:00
Samuel T
573ee94f35 All scripts/tests: always specify file encoding in calls to open() (#8882) 2022-10-11 22:29:36 +01:00
Hassan Abouelela
70e48ff799 Mention how to run stubtest directly on third party stubs (#8868)
Signed-off-by: Hassan Abouelela <hassan@hassanamr.com>
2022-10-08 17:15:35 -07:00
Alex Waygood
6a2232a30b Improve docs on running stubtest locally (#8822)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-10-08 16:29:48 -07: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
Samuel T
e5d52a39d4 Script to run all checks locally (#8798)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-10-04 07:21:10 -07:00