Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type check project the tests are running on #80

Merged
merged 2 commits into from
Mar 4, 2022
Merged

Conversation

flaeppe
Copy link
Contributor

@flaeppe flaeppe commented Feb 15, 2022

I split the content under tests/ in 2 to only allow tests([mypy-tests.tests.*]) to be excluded from type checking.

I considered type checking test cases too, but browsing quickly through the ~150 errors spewed out they're mainly hitting the disallow_untyped_defs-errors. So splitting it up like this felt like a reasonable compromise that'll capture meaningful errors from type usage.

Let me know what you think.

@github-actions
Copy link

github-actions bot commented Feb 15, 2022

File Coverage Lines Branches Missing
All files 94% 96% 91%
bananas/__init__.py 79% 83% 75% 19-20
bananas/environment.py 98% 97% 100% 223 229 232
bananas/models.py 98% 100% 96%
bananas/url.py 97% 100% 95%
bananas/admin/extension.py 94% 100% 88%
bananas/admin/api/i18n.py 91% 83% 100% 11
bananas/admin/api/mixins.py 72% 77% 67% 87 95-101 112 128 138-149
bananas/admin/api/serializers.py 91% 100% 83%
bananas/admin/api/versioning.py 93% 100% 87%
bananas/admin/api/views.py 99% 98% 100% 137
bananas/admin/api/schemas/base.py 91% 83% 100% 11
bananas/admin/api/schemas/yasg.py 90% 95% 86% 92 101 140-141
bananas/drf/fencing.py 91% 94% 87% 91-97 136
bananas/management/commands/syncpermissions.py 89% 95% 83% 32

Minimum allowed coverage is 85%

Generated by 🐒 cobertura-action against 2295f72

@antonagestam
Copy link
Contributor

@flaeppe

browsing quickly through the ~150 errors spewed out they're mainly hitting the disallow_untyped_defs-errors

We could always disable disallow_untyped_defs in tests? :)

@flaeppe flaeppe force-pushed the fix/typecheck-tests branch from dca16f2 to 2295f72 Compare March 3, 2022 21:59
@flaeppe
Copy link
Contributor Author

flaeppe commented Mar 3, 2022

@flaeppe

browsing quickly through the ~150 errors spewed out they're mainly hitting the disallow_untyped_defs-errors

We could always disable disallow_untyped_defs in tests? :)

Yeah, true. I did that and fixed some errors that popped up

@flaeppe flaeppe requested a review from antonagestam March 3, 2022 22:02
@flaeppe
Copy link
Contributor Author

flaeppe commented Mar 3, 2022

Could perhaps be nice to move to pytest as that might align better with mypy behaviour on native asserts:

assert isinstance(exc_info.exception.detail, ErrorDetail)
self.assertEqual(exc_info.exception.detail.code, "missing_header")

@antonagestam
Copy link
Contributor

@flaeppe Yeah would be nice to introduce pytest, a little surprising though that unittest's assertIsInstance doesn't use TypeGuard in typeshed yet.

@flaeppe flaeppe merged commit 44d3118 into master Mar 4, 2022
@flaeppe flaeppe deleted the fix/typecheck-tests branch March 4, 2022 12:52
@flaeppe
Copy link
Contributor Author

flaeppe commented Mar 4, 2022

@antonagestam indeed, that's a bit surprising

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants