Commit Graph

47 Commits

Author SHA1 Message Date
Sebastian Rittau bf246b28a9 Update to mypy 0.921 (#6657)
Test third-party stubs with typeshed from mypy
2021-12-22 07:57:07 -08:00
Jelle Zijlstra 1f1bc6f27c add pre-commit config (#6341)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-11-19 16:46:51 +02:00
Sebastian Rittau 77810277d5 Recommend to use mypy error codes if applicable (#6305) 2021-11-17 21:58:05 -08:00
Sebastian Rittau bcc743dd2b mypy_test: Skip files starting with '.' (#6306) 2021-11-16 17:00:39 +02:00
Sebastian Rittau edf82e8094 Clean up mypy flags (#6308)
* Remove --strict-optional: This has been the default since mypy 0.600.
* Remove --disallow-subclassing-any: When we subclass Any in typeshed,
  we do so deliberately. This just causes us to add unncessary ignores.
2021-11-16 12:58:53 +00:00
Sebastian Rittau e22b63d9cc Reduce mypy_test output (#6268)
Only print the mypy command twice per version: Once for the stdlib and
once for the stubs. Use a dummy /tmp path. Add a header for each tested
Python version and remove the Python version from the individual stubs.
2021-11-09 18:03:29 +01:00
Sebastian Rittau 3876587a65 Remove support for mypy_exclude_list (#6230) 2021-11-08 10:45:46 +02:00
Sebastian Rittau 50c1f2ab7c Test third-party stubs in isolation (#6229) 2021-11-07 15:05:49 -08:00
Nikita Sobolev 392c81d767 Switch from toml to tomli (#6023) 2021-09-10 15:48:15 +02:00
Sebastian Rittau 7c382c7cd8 Run mypy tests for stdlib and third-party separately (#5760) 2021-07-12 10:09:13 +02:00
Akuli 11b99e1141 @python2 nits (#5672)
* tiny tests/mypy_test.py cleanup

* try to make CONTRIBUTING.md less confusing
2021-06-21 21:42:45 +03:00
Sebastian Rittau 68dc2d132b Move Python 2-only stubs to @python2 directory (#5660) 2021-06-21 11:28:25 -07:00
Sebastian Rittau 54a0bd80ee Add a comment about _typeshed to VERSIONS (#5447) 2021-05-19 11:01:33 +02:00
Sebastian Rittau 35acd2ad6f check_consistent: allow dots in module names (#5472) 2021-05-16 11:01:00 -07:00
Sebastian Rittau 1eb64b4372 Mark stdlib modules with upper version bounds (#5394)
* Mark stdlib modules with upper version bounds

* Add minus to all versions and enforce in check_consistent

* Fix check_consistent and mypy_test to work with new VERSIONS format
2021-05-10 16:29:43 +03:00
Akuli 9f732a128a enable mypy_test for python 3.10 (#5341)
* enable mypy_test for python 3.10

* avoid collections.Mapping and collections.MutableMapping, import from typing
2021-05-05 00:09:33 +03:00
hatal175 fd2a176094 Allow per distribution mypy strictness options (#5169)
As requested by https://github.com/python/typeshed/issues/1526.

This addition takes mypy configuration from each distribution metadata file and constructs a single mypy.ini to run with. It assumes there is no mypy.ini but in case we ever need one, it would be simple to add these on top of an existing configuration file.
Might be relevant for #2852

As the issue did not really specify how the configuration would look, I added the following:
- You may add a mypy-tests section to the metadata file.
It looks like this:
[mypy-tests]
[mypy-tests.yaml]
module_name = "yaml"
[mypy-tests.yaml.values]
disallow_incomplete_defs = true
disallow_untyped_defs = true

- module_name can be of the form "a.*" like in mypy.ini.
- You can add several module sections for complex distributions with several modules.
- I added the '--warn-incomplete-stub' option since it is made specifically for typeshed runs. See docs.
2021-04-07 21:30:08 -07:00
Ivan Levkivskyi 16ae4c6120 Re-organize directory structure (#4971)
See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-01-27 12:00:39 +00:00
Shantanu a93fa6120e mypy_test: fix for stub deletions (#4816)
I think this should helps prevent issues like #4815

Co-authored-by: hauntsaninja <>
2020-12-13 23:41:20 -08:00
Shantanu 48970d31de tests / scripts: blacken and isort (#4704)
I often run black and isort in typeshed root and then have to undo these
changes.

Co-authored-by: hauntsaninja <>
2020-10-25 11:21:03 +01:00
wouter bolsterlee 3efb675dba Use ‘exclude list’ instead of ‘blacklist’ (#4297)
This replaces all uses of ‘blacklist’ with ‘exclude list’. Benefits:

- It is racially neutral terminology; see e.g. [1]

- It makes the meaning more clear. In fact, with the popular Python
  autoformatter called ‘black’, also used by this project, files can be
  ‘blackened’ which is something completely different from them being on
  a blacklist.

[1] https://chromium.googlesource.com/chromium/src/+/master/styleguide/inclusive_code.md#racially-neutral
2020-07-01 09:10:37 +02:00
Shantanu 997c73ae79 travis: start testing 3.9 somewhat (#4071)
* travis: run stubtest on py39, allowing failures

* travis: run mypy with python version 3.9

* boto.compat, base64: fix version handling of (en|de)codebytes

* venv: fix #4010

Co-authored-by: hauntsaninja <>
2020-05-24 18:45:16 -07:00
Sebastian Rittau fdeae5d00e Enable --disallow-subclassing-any (#3591)
Closes: #1446
2020-01-08 11:51:44 -08:00
Sebastian Rittau 66778639a5 Run CI tests against win32 and darwin platform (#3457)
Also use Python 3.8 as default Python version for tests
2019-11-11 07:52:11 -08:00
Sebastian Rittau c32e1e2280 Enable --disallow-any-generics for stubs (#3288) 2019-10-01 05:31:34 -07:00
Sebastian Rittau 9ccf9356bf Remove Python 3.4 support (#3147)
Closes #3123
2019-07-27 10:58:21 +02:00
Sebastian Rittau b20e5b6c14 Travis: run mypy with Python 3.8 as well (#3146)
This runs mypy both with Python 3.7 and 3.8. In Python 3.8,
mypy switched from using typed-ast to using Python's built-in ast.
This patch ensures that both are tested.
2019-07-25 07:43:52 -07:00
Sebastian Rittau 09d1055cd3 Remove mypy new analyzer tests (#3128)
Now that the new analyzer is the default, this does exactly the same
as the normal mypy self test.
2019-07-18 17:02:12 +02:00
Ivan Levkivskyi 61eb99664b Add new semantic analyzer to mypy tests (#3037)
This also removes two redundant definitions in curses/__init__.pyi star-imported from _curses.
2019-06-07 16:49:57 +01:00
Jelle Zijlstra cd9b7158ec fix CI (#2992) 2019-05-15 14:20:08 -07:00
Sebastian Rittau fa74160e1f Drop support for Python 3.3 (#2258)
Closes #2257.
2018-06-19 15:37:13 -07:00
Jelle Zijlstra c06a718c5b always run mypy with --no-implicit-optional (#2242)
This was already the configuration in Travis and it's been working fine. It's
confusing that Travis was using a different configuration than the default
when you run tests/mypy_test.py yourself.
2018-06-15 21:34:14 -07:00
Jelle Zijlstra 499f852e37 add --show-traceback to mypy_test.py flags (#2236)
This makes debugging easier.
2018-06-15 16:46:59 -07:00
Jelle Zijlstra 81a6ea43a5 try using --no-site-packages (#2036)
Fixes #2035.
2018-04-09 12:55:18 -07:00
Jelle Zijlstra ab72267669 also test 3.7 with mypy (#1917) 2018-02-24 09:56:35 -08:00
Guido van Rossum 04fe184dcf Add flags to pass on --warn-unused-ignores and --no-implicit-optional to mypy (#1421)
* Add flags to pass on --warn-unused-ignores and --no-implicit-optional to mypy
* Make implicit Optional explicit in arg types (2and3 part)
* Convert {stdlib,third_party}/2 to explicit Optional
2017-06-20 22:18:49 -07:00
Jelle Zijlstra 3101768f12 drop 3.2 (#1213)
Closes #1145.
2017-04-25 17:15:49 -07:00
David Fisher 2861674784 Remove unnecessary --fast-parser flag to mypy (#977)
It's now on by default, and the flag will eventually be removed.
2017-03-07 15:01:17 -08:00
Lukasz Langa 8c5c788a4d Enable flake8-pyi plugin to automatically include *.pyi files
This simplifies running flake8 tests and reduces the amount of F821 errors
reported (flake8-pyi enables support for forward references in *.pyi files).
The error code is left disabled until I clean up the remaining issues.
2016-12-21 00:56:01 -08:00
Lukasz Langa ab4ad3fe9d Make tests run with 3.6 --fast-parser, too 2016-11-26 20:17:28 -08:00
Guido van Rossum a353aabbcd Add commented-out flag to use --fast-parser. 2016-09-15 16:49:56 -07:00
Guido van Rossum d131efcaa0 Skip "module" whose name starts with ".". 2016-09-15 16:20:28 -07:00
Matthias Kramm c46993aa8e Add mypy blacklist, same syntax as pytype blacklist. (#508) 2016-08-29 14:23:39 -07:00
Guido van Rossum 39325bf159 Mypy now supports sys.platform and sys.version_info checks (#410) 2016-07-27 13:25:29 -07:00
Guido van Rossum f47ff0b966 Add --strict-optional flag to mypy (#368) 2016-07-13 17:50:36 +01:00
Alvaro Caceres 67ccb1b450 revert unnecessary change to mypy_test from previous commit 2016-07-12 18:46:09 -05:00
alvarocaceres 63cbe2dc3c Refactor how test are run, add tests to exercise pytype (if installed) (#353) 2016-07-12 15:30:54 -07:00