Skip to content

Commit

Permalink
Clean up tox.ini, update Makefile, fix Python 3.10 import error
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarychen committed Jan 15, 2024
1 parent edf00a2 commit 99e5957
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ endif

CONDA=source $$(conda info --base)/etc/profile.d/conda.sh ; conda activate

setup-miniconda:
brew install --cask miniconda -f

setup-conda-python:
conda remove --name py312-django-ninja-simple-jwt --all
conda create -n py312-django-ninja-simple-jwt python=3.12
conda remove --name py312-django-ninja-simple-jwt --all -y
conda create -n py312-django-ninja-simple-jwt python=3.12 -y

setup-venv:
rm -rf environment
$(CONDA) py312-django-ninja-simple-jwt ; python -m venv environment

python-requirements:
. environment/bin/activate && \
pip install --upgrade pip && \
pip install -r requirements.txt && \
pip install --upgrade pip -q && \
pip install -r requirements.txt -q && \
pre-commit install

conda-setup: setup-conda-python setup-venv python-requirements
system-setup: python-requirements
setup: setup-miniconda setup-conda-python setup-venv python-requirements

test:
. environment/bin/activate && tox
Expand Down
4 changes: 2 additions & 2 deletions ninja_simple_jwt/auth/views/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import UTC, datetime
from datetime import datetime, timezone

from django.contrib.auth import authenticate
from django.contrib.auth.signals import user_logged_in
Expand Down Expand Up @@ -64,7 +64,7 @@ def web_sign_in(request: HttpRequest, payload: SignInRequest, response: HttpResp
response.set_cookie(
key=ninja_simple_jwt_settings.JWT_REFRESH_COOKIE_NAME,
value=refresh_token,
expires=datetime.fromtimestamp(refresh_token_payload["exp"], UTC),
expires=datetime.fromtimestamp(refresh_token_payload["exp"], timezone.utc),
httponly=ninja_simple_jwt_settings.WEB_REFRESH_COOKIE_HTTP_ONLY,
samesite=ninja_simple_jwt_settings.WEB_REFRESH_COOKIE_SAME_SITE_POLICY,
secure=ninja_simple_jwt_settings.WEB_REFRESH_COOKIE_SECURE,
Expand Down
4 changes: 0 additions & 4 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

LANGUAGE_CODE = "en-us"

SITE_ID = 1

USE_I18N = True
USE_L10N = True
USE_TZ = True

MEDIA_ROOT = ""
Expand Down
4 changes: 1 addition & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ deps =
{[base]deps}
dj42: Django>=4.2,<5.0
dj50: Django>=5.0,<5.1
commands = pytest
commands = python -m django test
setenv =
DJANGO_SETTINGS_MODULE = tests.settings
PYTHONPATH = {toxinidir}
Expand All @@ -33,5 +33,3 @@ python_files = test_*.py
[base]
deps =
-r requirements.txt
pytest
pytest-django

0 comments on commit 99e5957

Please sign in to comment.