Commit Graph

87 Commits

Author SHA1 Message Date
Maxim Kurnikov
be3fc259d5 fix compatibility with 0.730 (#189) 2019-09-28 05:23:55 +03:00
Maxim Kurnikov
7725b416b6 add unused ignores reporting (#188) 2019-09-28 04:48:44 +03:00
Maxim Kurnikov
a85dbff793 update import_all test, add some stubs for postgres (#178) 2019-09-23 19:47:11 +03:00
Maxim Kurnikov
2b53fa5a1a Fix typecheck tests ci (#165)
* remove mention of mypy newsemanal to prepare for 0.730

* make typecheck_tests CI really work

* fix lints

* fix intentional error

* merge stderr in stdout to preserve order

Co-authored-by: Daniel Hahler <github@thequod.de>
2019-09-16 14:35:13 +03:00
Daniel Hahler
e3ea84143f WIP: fix scripts/typecheck_tests.py (#162)
* WIP: fix scripts/typecheck_tests.py

Exit non-zero if it fails to run.

Currently it fails on CI, but goes unnoticed:
https://travis-ci.com/typeddjango/django-stubs/jobs/235296115

* exit on unexpected rc, and output on stderr

* Fix

* scripts/mypy.ini: django_settings_module=scripts.django_tests_settings
2019-09-14 22:23:45 +03:00
Maxim Kurnikov
fc9a335dfd make ValuesQuerySet have proper Collection generic type (#140) 2019-08-24 18:24:21 +03:00
Maxim Kurnikov
656105bab2 make first() an Optional, allow to specify QuerySet with one parameter (#136) 2019-08-23 03:31:07 +03:00
Maxim Kurnikov
bc42cc2fa1 add python3.6 tests typechecking 2019-07-25 19:56:37 +03:00
Maxim Kurnikov
a0a2ecaf46 fix additional mypy config and auto settings 2019-07-25 19:14:36 +03:00
Maxim Kurnikov
a97d76020c enable tests typechecking using django submodule 2019-07-24 23:44:57 +03:00
Maxim Kurnikov
b6a5ccabdf move configuration to [mypy.plugins.django-stubs] inside mypy config file 2019-07-24 22:32:52 +03:00
Maxim Kurnikov
6332620443 rewrite pytest-mypy-plugin extension code to use new hook 2019-07-24 13:39:24 +03:00
Maxim Kurnikov
335c5765c3 enable test folders: select_for_update, i18n, httpwrappers, auth_tests, extra_regress (#107) 2019-07-10 19:38:36 +03:00
Maxim Kurnikov
b397ec04a9 add utils_tests test folder to typechecking (#106) 2019-07-10 18:19:37 +03:00
Maxim Kurnikov
2799646723 add missing files throughout the codebase (#102) 2019-07-09 05:18:15 +03:00
Maxim Kurnikov
d8230a4147 Add typechecking for 'file_storage', 'files' test folders (#101)
* add typechecking for 'file_storage', 'files' test folders

* fix File class annotations
2019-07-07 03:58:00 +03:00
Maxim Kurnikov
a77d5b27d8 Update typecheck_tests to django 2.2 branch, remove unused ignores (#98)
* update typecheck_tests to django 2.2 branch, remove unused ignores

* lint fixes
2019-07-01 18:44:34 +03:00
Maxim Kurnikov
aeb435c8b3 Disable monkeypatches, add dependencies via new hook (#60)
* code cleanups, disable monkeypatches, move to add_additional_deps

* disable incremental mode for tests

* add pip-wheel-metadata

* move some code from get_base_hook to get_attribute_hook to reduce dependencies

* simplify values/values_list tests and code

* disable cache for some tests failing with incremental mode

* enable incremental mode for tests typechecking

* pin mypy version

* fix tests

* lint

* fix internal crashes
2019-04-12 14:54:00 +03:00
Seth Yastrov
71fb0432f3 52/model subtypes dont typecheck (#55)
* Fix problem where Model instancess are not considered subtypes of each other due to fallback_to_any = True. Fixes #52.

- Added a stub for __getstate__ to Model.
- Added a stub for clean() to Model.
- Correct arg type for sort_dependencies so they are covariant (Iterable rather than List).

Test ignores:
- Added some test ignores in cases where a model inherits from 2 different base models.
- Added some test ignores for cases that MyPy flags as errors due to variable redefinitions or imports that are incompatible types.

* Address review comment.
2019-03-28 23:13:02 +03:00
Maxim Kurnikov
5c6be7ad12 Add test to import all modules to check validity of stubs (#56)
* add import_all.test builder

* fix errors

* fix typechecking errors

* fix migrations typechecking
2019-03-25 01:57:34 +03:00
Seth Yastrov
324b961d74 Support returning the correct values for the different QuerySet methods when using .values() and .values_list(). (#33)
* Support returning the correct values for the different QuerySet methods when using .values() and .values_list().

* Fix slicing on QuerySet. Fix django queries test, and remove some ignored errors that are no longer needed.

* Remove accidental change in RawQuerySet.

* Readded some still-necessary ignores to aggregation django test.

* Add more tests of first/last/earliest/last/__getitem__, per mkurnikov's comments.

- Fix .iterator()

* Re-add Iterator as base-class of QuerySet.

* Make QuerySet a Collection.

* - Fix return type for QuerySet.select_for_update().
- Use correct return type for QuerySet.dates() / QuerySet.datetimes().
- Use correct type params in return type for QuerySet.__and__ / QuerySet.__or__
- Re-add Sized as base class for QuerySet.
- Add test of .all() for all _Row types.
- Add test of .get() for all _Row types.
- Remove some redundant QuerySet method tests.

* Automatically fill in second type parameter for QuerySet.

... if second parameter is omitted.
2019-03-10 12:13:50 +03:00
Seth Yastrov
86c63d790b Fix type errors on other models' managers when using objects = models.Manager() in Model. (#34)
* Fix bug where models with a class variable using a manager defined would interfere with other managers.

- Fill in the type argument for that particular instance of the manager, rather than modifying the bases of the Manager type.
- Instantiate a new Instance from determine_proper_manager_type so The code doesn't crash under mypy-mypyc.

* Use helpers.reparametrize_instance per review comment.

* Updated ignored errors in Django test for get_objects_or_404.

- For some reason, `Manager[nothing]` is now removed from expected types.
  However, I think this makes sense anyway, as Manager is a subclass of QuerySet.
2019-03-08 12:30:38 +03:00
Maxim Kurnikov
9e4ed70fc5 Disable note: messages (#35)
* add global note: ignore
2019-03-01 05:15:05 +03:00
Maxim Kurnikov
c962b8ac68 attempt to add flake8 and isort 2019-03-01 02:07:53 +03:00
Maxim Kurnikov
df5c70c703 fixes for FormMixin's get_form/get_form_class 2019-02-25 04:01:36 +03:00
Seth Yastrov
0e30821ad3 Add possibility to pass list of test names as command-line arguments to typecheck_tests.py script. 2019-02-22 20:03:30 +01:00
Seth Yastrov
2dadd681ff Change in_bulk id_list param to Iterable rather than Sequence. 2019-02-22 20:03:20 +01:00
Maxim Kurnikov
2d3b5492f0 fix form errors in CI 2019-02-20 21:24:49 +03:00
Maxim Kurnikov
116aa2c539 clean up forms 2019-02-20 15:22:46 +03:00
Maxim Kurnikov
5d8cdbcf29 fix integer set type 2019-02-20 02:38:45 +03:00
Maxim Kurnikov
632e063e22 back to incremental = True for tests 2019-02-18 02:16:13 +03:00
Maxim Kurnikov
e5b2496eb5 update django tests sources to latest commit 2019-02-18 01:05:57 +03:00
Maxim Kurnikov
f980311be0 finish strict_optional support, enable it for typechecking of django tests 2019-02-18 00:52:56 +03:00
Maxim Kurnikov
400a0f0486 silence some false positives 2019-02-17 20:20:33 +03:00
Maxim Kurnikov
e9f9202ed1 preliminary support for strict_optional 2019-02-17 18:07:53 +03:00
Maxim Kurnikov
dcd9ee0bb8 enable 'validation' test folder 2019-02-13 21:12:58 +03:00
Maxim Kurnikov
79ebe20f2e add more test folders 2019-02-13 19:44:25 +03:00
Maxim Kurnikov
2720b74242 add proper generic support for get_object_or_404/get_list_or_404, fixes #22 2019-02-13 14:52:10 +03:00
Maxim Kurnikov
cf7c263fb5 fix tests 2019-02-12 17:09:28 +03:00
Maxim Kurnikov
9eb95fbab3 add BaseManager.create() typechecking 2019-02-12 03:54:48 +03:00
Maxim Kurnikov
d05e739d75 fix ci 2019-02-11 01:29:30 +03:00
Maxim Kurnikov
faefdcca5b fix ci 2019-02-11 01:12:59 +03:00
Maxim Kurnikov
643f852775 enable two more test folders 2019-02-10 04:41:54 +03:00
Maxim Kurnikov
6b7507206a fix couple edge cases with __init__ 2019-02-10 04:32:27 +03:00
Maxim Kurnikov
916df1efb6 add Model.__init__ typechecking 2019-02-08 17:16:03 +03:00
Maxim Kurnikov
faee26703e fix ci 2019-02-07 02:10:53 +03:00
Maxim Kurnikov
f7b586f038 ci should be good now 2019-02-07 01:43:34 +03:00
Maxim Kurnikov
56cd3bc77d fix ci 2019-02-07 01:27:29 +03:00
Maxim Kurnikov
11500f337d try ci fix 2019-02-07 01:19:19 +03:00
Maxim Kurnikov
723d9fbfb7 fix 2019-02-07 01:04:43 +03:00