Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ dev-setup:
tests:
PYTHONPATH=. pytest graphene_django --cov=graphene_django -vv

.PHONY: tests-repeat ## Run unit tests 100 times in parallel to surface flaky tests (requires pip install -e ".[test]")
tests-repeat:
PYTHONPATH=. pytest graphene_django --cov=graphene_django -vv --count 100 -n logical

.PHONY: format ## Format code
format:
ruff format graphene_django examples setup.py
Expand Down
12 changes: 6 additions & 6 deletions examples/starwars/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ def initialize():
falcon = Ship(id="4", name="Millennium Falcon", faction=rebels)
falcon.save()

homeOne = Ship(id="5", name="Home One", faction=rebels)
homeOne.save()
home_one = Ship(id="5", name="Home One", faction=rebels)
home_one.save()

tieFighter = Ship(id="6", name="TIE Fighter", faction=empire)
tieFighter.save()
tie_fighter = Ship(id="6", name="TIE Fighter", faction=empire)
tie_fighter.save()

tieInterceptor = Ship(id="7", name="TIE Interceptor", faction=empire)
tieInterceptor.save()
tie_interceptor = Ship(id="7", name="TIE Interceptor", faction=empire)
tie_interceptor.save()

executor = Ship(id="8", name="Executor", faction=empire)
executor.save()
Expand Down
22 changes: 8 additions & 14 deletions graphene_django/debug/exception/formating.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import traceback
"""Backwards-compatibility shim for the misspelled ``formating`` module.

from django.utils.encoding import force_str
The canonical module is now :mod:`graphene_django.debug.exception.formatting`.
This shim re-exports its public symbols so that any third-party code still
importing the legacy name continues to work. It is deprecated and will be
removed in a future major release.
"""

from .types import DjangoDebugException
from .formatting import wrap_exception # noqa: F401 - re-exported for backwards compatibility


def wrap_exception(exception):
return DjangoDebugException(
message=force_str(exception),
exc_type=force_str(type(exception)),
stack="".join(
traceback.format_exception(
exception, value=exception, tb=exception.__traceback__
)
),
)
__all__ = ["wrap_exception"]
17 changes: 17 additions & 0 deletions graphene_django/debug/exception/formatting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import traceback

from django.utils.encoding import force_str

from .types import DjangoDebugException


def wrap_exception(exception):
return DjangoDebugException(
message=force_str(exception),
exc_type=force_str(type(exception)),
stack="".join(
traceback.format_exception(
exception, value=exception, tb=exception.__traceback__
)
),
)
2 changes: 1 addition & 1 deletion graphene_django/debug/middleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.db import connections

from .exception.formating import wrap_exception
from .exception.formatting import wrap_exception
from .sql.tracking import unwrap_cursor, wrap_cursor
from .types import DjangoDebug

Expand Down
Loading
Loading