Skip to content

Commit ca77f7e

Browse files
authored
Merge pull request #333 from eadwinCode/chores_ninja_upgrade
chores: Django V6.0 CI Tests
2 parents 2550fc3 + 07b29c5 commit ca77f7e

File tree

6 files changed

+30
-76
lines changed

6 files changed

+30
-76
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
- name: Set up Python
1515
uses: actions/setup-python@v6
1616
with:
17-
python-version: '3.10'
17+
python-version: '3.12'
1818
- name: Install Flit
19-
run: pip install flit
19+
run: pip install flit "django>=5.2"
2020
- name: Install Dependencies
2121
run: make install
2222
- name: Test

.github/workflows/test_full.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,38 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
15-
django-version: [ '<3.2', '<3.3', '<4.2', '<4.3', '<5.1' ]
14+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
15+
django-version: ['<3.2', '<3.3', '<4.2', '<4.3', '<5.1', '<5.2', '<5.3', '<6.1']
1616
exclude:
1717
- python-version: '3.8'
1818
django-version: '<5.1'
19+
1920
- python-version: '3.9'
2021
django-version: '<5.1'
22+
2123
- python-version: '3.12'
2224
django-version: '<3.2'
2325
- python-version: '3.12'
2426
django-version: '<3.3'
27+
28+
- python-version: '3.13'
29+
django-version: '<3.2'
30+
- python-version: '3.13'
31+
django-version: '<3.3'
32+
33+
# as of oct 2025 looks like django < 5.2 does not support python 3.14
34+
- python-version: '3.14'
35+
django-version: '<3.2'
36+
- python-version: '3.14'
37+
django-version: '<3.3'
38+
- python-version: '3.14'
39+
django-version: '<4.2'
40+
- python-version: '3.14'
41+
django-version: '<4.3'
42+
- python-version: '3.14'
43+
django-version: '<5.1'
44+
- python-version: '3.14'
45+
django-version: '<5.2'
2546
steps:
2647
- uses: actions/checkout@v6
2748
- name: Set up Python
@@ -42,7 +63,7 @@ jobs:
4263
- name: Set up Python
4364
uses: actions/setup-python@v6
4465
with:
45-
python-version: '3.10'
66+
python-version: '3.12'
4667
- name: Install Flit
4768
run: pip install flit
4869
- name: Install Dependencies

ninja_extra/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Django Ninja Extra - Class Based Utility and more for Django Ninja(Fast Django REST framework)"""
22

3-
__version__ = "0.30.6"
3+
__version__ = "0.30.8"
44

55
import django
66

ninja_extra/controllers/route/route_functions.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import inspect
2-
import warnings
32
from contextlib import contextmanager
43
from functools import wraps
54
from typing import TYPE_CHECKING, Any, Callable, Iterator, Optional, Tuple, cast
@@ -114,23 +113,6 @@ def as_view(
114113
as_view.get_route_function = lambda: self # type:ignore
115114
return as_view
116115

117-
def _process_view_function_result(self, result: Any) -> Any:
118-
"""
119-
This process any a returned value from view_func
120-
and creates an api response if a result is ControllerResponseSchema
121-
122-
deprecated:: 0.21.5
123-
This method is deprecated and will be removed in a future version.
124-
The result processing should be handled by the response handlers.
125-
"""
126-
warnings.warn(
127-
"_process_view_function_result() is deprecated and will be removed in a future version. "
128-
"The result processing should be handled by the response handlers.",
129-
DeprecationWarning,
130-
stacklevel=2,
131-
)
132-
return result
133-
134116
def _get_controller_instance(self) -> "ControllerBase":
135117
from ninja_extra.controllers.base import ModelControllerBase
136118

@@ -155,26 +137,6 @@ def _get_controller_instance(self) -> "ControllerBase":
155137

156138
return controller_instance
157139

158-
def get_route_execution_context(
159-
self, request: HttpRequest, *args: Any, **kwargs: Any
160-
) -> RouteContext:
161-
warnings.warn(
162-
"get_route_execution_context() is deprecated in favor of "
163-
"ninja_extra.controllers.route.context.get_route_execution_context()",
164-
DeprecationWarning,
165-
stacklevel=2,
166-
)
167-
168-
init_kwargs = {
169-
"permission_classes": self.route.permissions
170-
or self.api_controller.permission_classes,
171-
"request": request,
172-
"kwargs": kwargs,
173-
"args": args,
174-
}
175-
context = RouteContext(**init_kwargs) # type:ignore[arg-type]
176-
return context
177-
178140
@contextmanager
179141
def _prep_controller_route_execution(
180142
self, route_context: RouteContext, **kwargs: Any

ninja_extra/exceptions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ def __new__(
7171

7272
def __eq__(self, other: object) -> bool:
7373
r = super().__eq__(other)
74+
if r is NotImplemented:
75+
return NotImplemented # pragma: no cover
7476
try:
7577
return r and self.code == other.code # type: ignore
76-
except AttributeError:
78+
except AttributeError: # pragma: no cover
7779
return r
7880

7981
def __ne__(self, other: object) -> bool:

tests/test_route.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from ninja_extra import api_controller, permissions, route
1010
from ninja_extra.constants import ROUTE_OBJECT
1111
from ninja_extra.context import (
12-
RouteContext,
1312
get_route_execution_context,
1413
)
1514
from ninja_extra.controllers import (
@@ -20,7 +19,6 @@
2019
from ninja_extra.controllers.base import get_route_functions
2120
from ninja_extra.controllers.utils import get_api_controller
2221
from ninja_extra.exceptions import PermissionDenied
23-
from ninja_extra.permissions import AllowAny
2422
from ninja_extra.reflect import reflect
2523

2624
from .schemas import UserSchema
@@ -320,22 +318,6 @@ def test_get_required_api_func_signature_return_filtered_signature(self):
320318
assert len(sig_parameter) == 1
321319
assert str(sig_parameter[0]).replace(" ", "") == "example_id:str"
322320

323-
def test_get_route_execution_context(self):
324-
route.get("")(self.api_func)
325-
route_object = reflect.get_metadata_or_raise_exception(
326-
ROUTE_OBJECT, self.api_func
327-
)
328-
route_function = RouteFunction(route_object, Mock())
329-
route_function.api_controller.permission_classes = [AllowAny]
330-
331-
route_context = route_function.get_route_execution_context(
332-
anonymous_request, "arg1", "arg2", extra="extra"
333-
)
334-
assert isinstance(route_context, RouteContext)
335-
expected_keywords = ("permission_classes", "request", "args", "kwargs")
336-
for key in expected_keywords:
337-
assert getattr(route_context, key)
338-
339321
def test_get_controller_instance_return_controller_instance(
340322
self, get_route_function
341323
):
@@ -348,19 +330,6 @@ def test_get_controller_instance_return_controller_instance(
348330
assert isinstance(controller_instance, SomeTestController)
349331
assert controller_instance.context is None
350332

351-
def test_process_view_function_result_return_tuple_or_input(
352-
self, get_route_function
353-
):
354-
route_function: RouteFunction = get_route_function(SomeTestController().example)
355-
mock_result = {"detail": "Some Message", "status_code": 302}
356-
response = route_function._process_view_function_result(mock_result)
357-
assert response == mock_result
358-
359-
mock_result = {"status": 302, "message": "Some Message"}
360-
response = route_function._process_view_function_result(mock_result)
361-
assert not isinstance(response, tuple)
362-
assert response == mock_result
363-
364333

365334
@pytest.mark.django_db
366335
class TestAPIControllerRoutePermission:

0 commit comments

Comments
 (0)