Skip to content

Commit

Permalink
🤝 Adds nox and updates tests (#182)
Browse files Browse the repository at this point in the history
* ✨ Adds nox and updates testing

* ⚙️ Adds pip-compile recipe

* ⬆️ Adds nox and re-freezes
  • Loading branch information
jefftriplett authored Jan 28, 2023
1 parent 1e17658 commit efcfd5c
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ jobs:


steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
cache: 'pip'
python-version: ${{ matrix.python-version }}
Expand Down
3 changes: 0 additions & 3 deletions example/sample/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.auth.middleware.SessionAuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django.middleware.security.SecurityMiddleware",
Expand Down Expand Up @@ -92,8 +91,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True


Expand Down
17 changes: 17 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@_default:
just --list

@fmt:
just --fmt --unstable

@nox *ARGS:
nox --no-install --reuse-existing-virtualenvs {{ ARGS }}

@pip-compile:
pip-compile --resolver=backtracking

@pre-commit:
git ls-files -- . | xargs pre-commit run --config=.pre-commit-config.yaml --files

@test *ARGS:
nox --reuse-existing-virtualenvs {{ ARGS }}
26 changes: 26 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import nox

DJANGO_VERSIONS = ["2.2", "3.2", "4.0", "4.1"]
PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]

INVALID_PYTHON_DJANGO_SESSIONS = [
("3.6", "4.0"),
("3.6", "4.1"),
("3.6", "4.2"),
("3.7", "4.0"),
("3.7", "4.1"),
("3.7", "4.2"),
("3.11", "3.2"),
# ("3.11", "4.0"),
# ("3.11", "4.1"),
]


@nox.session(python=PYTHON_VERSIONS, tags=["django"])
@nox.parametrize("django", DJANGO_VERSIONS)
def tests(session: nox.Session, django: str) -> None:
if (session.python, django) in INVALID_PYTHON_DJANGO_SESSIONS:
session.skip()
session.install(".[test]")
session.install(f"django~={django}")
session.run("pytest", *session.posargs)
7 changes: 7 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[pytest]
DJANGO_SETTINGS_MODULE=sample.settings
addopts = --reuse-db
norecursedirs = build dist docs .eggs/* *.egg-info htmlcov test_plus .git .nox .*
python_files = test*.py
site_dirs = example/
testpaths = friendship
13 changes: 7 additions & 6 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
bumpversion
check-manifest
Django<4.2
pytest
pytest-django
pytest-cov
pytest-pythonpath
factory-boy
flake8
nox
pyflakes
bumpversion
pytest
pytest-cov
pytest-django
pytest-pythonpath
twine
check-manifest
25 changes: 20 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile
# pip-compile --resolver=backtracking
#
argcomplete==2.0.0
# via nox
asgiref==3.6.0
# via django
attrs==22.2.0
Expand All @@ -22,10 +24,14 @@ charset-normalizer==3.0.1
# via requests
check-manifest==0.49
# via -r requirements.in
colorlog==6.7.0
# via nox
commonmark==0.9.1
# via rich
coverage[toml]==7.0.5
# via pytest-cov
distlib==0.3.6
# via virtualenv
django==4.1.5
# via -r requirements.in
docutils==0.19
Expand All @@ -34,6 +40,8 @@ factory-boy==3.2.1
# via -r requirements.in
faker==16.4.0
# via factory-boy
filelock==3.9.0
# via virtualenv
flake8==6.0.0
# via -r requirements.in
idna==3.4
Expand All @@ -44,20 +52,25 @@ importlib-metadata==6.0.0
# twine
iniconfig==2.0.0
# via pytest
jaraco.classes==3.2.3
jaraco-classes==3.2.3
# via keyring
keyring==23.13.1
# via twine
mccabe==0.7.0
# via flake8
more-itertools==9.0.0
# via jaraco.classes
# via jaraco-classes
nox==2022.11.21
# via -r requirements.in
packaging==23.0
# via
# build
# nox
# pytest
pkginfo==1.9.6
# via twine
platformdirs==2.6.2
# via virtualenv
pluggy==1.0.0
# via pytest
py==1.11.0
Expand Down Expand Up @@ -120,6 +133,8 @@ urllib3==1.26.14
# via
# requests
# twine
virtualenv==20.17.1
# via nox
webencodings==0.5.1
# via bleach
zipp==3.11.0
Expand Down

0 comments on commit efcfd5c

Please sign in to comment.