feat(backend): add typechecking with ty (#9664)

* Add ty for type checking

* fix various typing issues

* fix req

* more fixes

* and more types

* and more typing

* fix imports

* more fixes

* fix types and optional statements

* ensure patch only runs if it is installed

* add type check to qc

* more fixes

* install all reqs

* fix more types

* more fixes

* disable container stuff for now

* move typecheck to seperate job

* try to use putput for path

* use env instead

* fix typo

* add missing install

* remove unclear imports - not sure why this was done

* add kwarg names

* fix introduced issue in url call

* ignore import

* fix broken typing changes

* fix filter import

* reduce change set

* remove api-change

* fix dict

* ignore typing errors

* fix more type issues

* ignore errors

* style fix

* fix type

* bump ty

* fix more

* type fixes

* update ignores

* fix import

* fix defaults

* fix ignore

* fix some issues

* fix type
This commit is contained in:
Matthias Mair authored and GitHub committed 2025-09-17 21:30:02 +10:00
1 parent f057247fc1
commit 21cb488eef
100 files changed
+524 -267

No files matched your search

+4
View File
@@ -131,6 +131,8 @@ class UserAPITests(InvenTreeAPITestCase):
def test_user_detail(self):
"""Test the UserDetail API endpoint."""
user = User.objects.first()
assert user
url = reverse('api-user-detail', kwargs={'pk': user.pk})
user.is_staff = False
@@ -274,6 +276,7 @@ class UserTokenTests(InvenTreeAPITestCase):
# If we re-generate a token, the value changes
token = ApiToken.objects.filter(name='cat').first()
assert token
# Request the token with the same name
data = self.get(url, data={'name': 'cat'}, expected_code=200).data
@@ -331,6 +334,7 @@ class UserTokenTests(InvenTreeAPITestCase):
# Grab the token, and update
token = ApiToken.objects.first()
assert token
self.assertEqual(token.key, token_key)
self.assertIsNotNone(token.last_seen)