Skip to content

Commit 1eb67f0

Browse files
committed
fixed cov failing test
1 parent 4e21cb7 commit 1eb67f0

File tree

5 files changed

+14
-19
lines changed

5 files changed

+14
-19
lines changed

Makefile

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,27 @@ clean: ## Removing cached python compiled files
1010
find . -name \*~ | xargs rm -fv
1111
find . -name __pycache__ | xargs rm -rfv
1212

13-
install: ## Install dependencies
14-
make clean
13+
install:clean ## Install dependencies
1514
flit install --deps develop --symlink
1615
pre-commit install -f
1716

18-
lint: ## Run code linters
17+
lint:fmt ## Run code linters
1918
make clean
2019
black --check ninja_extra tests
2120
ruff check ninja_extra tests
2221
mypy ninja_extra
2322

24-
fmt format: ## Run code formatters
25-
make clean
23+
fmt format:clean ## Run code formatters
2624
black ninja_extra tests
2725
ruff check --fix ninja_extra tests
2826

2927

30-
test: ## Run tests
31-
make clean
28+
test:clean ## Run tests
3229
pytest .
3330

34-
test-cov: ## Run tests with coverage
31+
test-cov:clean ## Run tests with coverage
3532
make clean
3633
pytest --cov=ninja_extra --cov-report term-missing tests
3734

38-
doc-deploy: ## Run Deploy Documentation
39-
make clean
35+
doc-deploy:clean ## Run Deploy Documentation
4036
mkdocs gh-deploy --force

ninja_extra/controllers/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ def _get_permissions(self) -> Iterable[BasePermission]:
166166
"""
167167
Instantiates and returns the list of permissions that this view requires.
168168
"""
169-
if not self.context:
170-
return
169+
assert self.context
171170

172171
for permission_class in self.context.permission_classes:
173172
if isinstance(permission_class, (type, OperationHolderMixin)):

ninja_extra/exceptions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
DRF Exceptions
33
"""
44
import math
5-
from typing import Any, Dict, List, Optional, Type, Union, cast, no_type_check
5+
from typing import Any, Dict, List, Optional, Type, Union, no_type_check
66

77
from django.http import HttpRequest, HttpResponse, JsonResponse
88
from django.utils.encoding import force_str
@@ -104,7 +104,7 @@ def __init__(
104104
code: Optional[Union[str, int]] = None,
105105
) -> None:
106106
if detail is None:
107-
detail = cast(str, self.default_detail) # type:ignore[redundant-cast]
107+
detail = self.default_detail
108108
if code is None:
109109
code = self.default_code
110110

@@ -149,7 +149,7 @@ def __init__(
149149
code: Optional[Union[str, int]] = None,
150150
):
151151
if detail is None:
152-
detail = cast(str, self.default_detail) # type:ignore[redundant-cast]
152+
detail = self.default_detail
153153
if code is None:
154154
code = self.default_code
155155

ninja_extra/signals.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from django.dispatch import Signal
1+
from django.dispatch import Signal # pragma: no cover
22

3-
route_context_started = Signal()
4-
route_context_finished = Signal()
3+
route_context_started = Signal() # pragma: no cover
4+
route_context_finished = Signal() # pragma: no cover

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ test = [
6262
"pytest-cov",
6363
"pytest-django",
6464
"pytest-asyncio",
65-
"mypy == 1.4.1",
65+
"mypy == 1.5.1",
6666
"ruff ==0.0.275",
6767
"black == 23.7.0",
6868
"injector >= 0.19.0",

0 commit comments

Comments
 (0)