Commit Graph

71 Commits

Author SHA1 Message Date
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
Maxim Kurnikov
3fb3bbcf19 fix values_list 2019-02-07 01:01:05 +03:00
Maxim Kurnikov
191496ed72 enable some test folders, bunch of fixes 2019-02-07 00:08:05 +03:00
Maxim Kurnikov
2559901ff3 more test folders 2019-02-06 20:56:44 +03:00
Maxim Kurnikov
d18fc0bf5f enable 6 more test folders 2019-02-06 14:29:42 +03:00
Maxim Kurnikov
dbc9b49867 add test_runner/lookup test folders 2019-02-05 16:41:28 +03:00
Maxim Kurnikov
e4d2b795e3 fix ci 2019-02-05 16:09:42 +03:00
Maxim Kurnikov
be0b2eebb2 add central directory for mypy cache 2019-02-05 15:35:01 +03:00
Maxim Kurnikov
38291e0651 fix ci 2019-02-04 19:38:19 +03:00
Maxim Kurnikov
69d4ccaf54 fixes, add some testing folders 2019-02-04 19:31:37 +03:00
Maxim Kurnikov
f5135dac9f expressions 2019-02-03 20:41:27 +03:00
Maxim Kurnikov
59b4d2e849 add custom_lookups, custom_managers test folders 2019-02-03 20:06:13 +03:00
Maxim Kurnikov
5f6b4bfd30 add test_views test folder 2019-02-03 19:51:17 +03:00
Maxim Kurnikov
d03fddd96d split error suppression for tests typechecking, fix ci, bunch of fixes 2019-02-03 19:33:51 +03:00
Oleg Nykolyn
3ccecebe3f Fix and uncomment tests. 2019-01-31 21:35:35 +02:00
Maxim Kurnikov
7f8477ff3d silence failing test folders 2019-01-31 18:43:38 +03:00
Maxim Kurnikov
815c3ea497 add missing comma 2019-01-31 18:28:52 +03:00