Skip to content

Commit

Permalink
🔨 Work off of Chris's branch (#212)
Browse files Browse the repository at this point in the history
* Use pytest's native python path support

This is added in Pytest 7

Fixes my failure to locally CI as mentioned in #210 (comment)

* 🔨 ⬆️ Updates for uv and expand the matrix

* ⬆️ Upgrade actions versions

* 📝 Fixes uv pip install

* 🔥 Removes 3.6 and 3.7

GitHub dropped support for 3.6 and 3.7

* 🚜 Bumps support

---------

Co-authored-by: Chris Rose <offline@offby1.net>
  • Loading branch information
jefftriplett and offbyone authored May 3, 2024
1 parent 93ab347 commit 9039f37
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 34 deletions.
38 changes: 15 additions & 23 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand All @@ -29,8 +27,8 @@ jobs:
django-version:
- "2.2" # LTS
- "3.2" # LTS
- "4.1"
- "4.2" # LTS
- "5.0"
drf-version:
- ""
- "3.14" # only testing latest version for now
Expand All @@ -54,45 +52,39 @@ jobs:
django-version: "2.2"
- python-version: "3.12"
django-version: "3.2"
# Django 4.0 is compatible with Python 3.8+
- python-version: "3.6"
django-version: "4.0"
- python-version: "3.7"
django-version: "4.0"
# Django 4.1 is compatible with Python 3.8+
- python-version: "3.6"
django-version: "4.1"
- python-version: "3.7"
django-version: "4.1"
# Django 4.2 is compatible with Python 3.8+
- python-version: "3.6"
django-version: "4.2"
- python-version: "3.7"
django-version: "4.2"
# Django 5.0 is compatible with Python 3.10+
- python-version: "3.8"
django-version: "5.0"
- python-version: "3.9"
django-version: "5.0"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: '**/setup.cfg'

- name: Install dependencies
run: |
python -m pip install uv
- name: Install Django ${{ matrix.django-version }}
if: ${{ matrix.drf-version == '' }}
run: |
python -m pip install "Django~=${{ matrix.django-version }}.0"
python -m uv pip install --system "Django~=${{ matrix.django-version }}.0"
- name: Install DRF ${{ matrix.drf-version }} and Django ${{ matrix.django-version }}
if: ${{ matrix.drf-version }}
run: |
python -m pip install pytz "djangorestframework~=${{ matrix.drf-version }}.0" "Django~=${{ matrix.django-version }}.0"
python -m uv pip install --system pytz "djangorestframework~=${{ matrix.drf-version }}.0" "Django~=${{ matrix.django-version }}.0"
- name: Install dependencies
run: |
python -m pip install -e ".[test]"
python -m uv pip install --system -e ".[test]"
- run: |
pytest .
9 changes: 5 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ jobs:
PYTHONDONTWRITEBYTECODE: true
PYTHONPATH: test_project
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: '**/setup.cfg'

- name: Install dependencies
run: |
python -m pip install -e "."
python -m pip install -e ".[test]"
python -m pip install uv
python -m uv pip install --system -e "."
python -m uv pip install --system -e ".[test]"
- name: Lint with flake8
run: |
Expand Down
7 changes: 4 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import nox

DJANGO_VERSIONS = ["2.2", "3.2", "4.1", "4.2"]
DJANGO_VERSIONS = ["2.2", "3.2", "4.2", "5.0"]
DRF_VERSIONS = ["3.11", "3.12", "3.13", "3.14"]
PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"]

INVALID_PYTHON_DJANGO_SESSIONS = [
("3.11", "3.2"),
("3.12", "2.2"),
("3.12", "3.2"),
]


@nox.session(python=PYTHON_VERSIONS, tags=["django"])
@nox.session(python=PYTHON_VERSIONS, tags=["django"], venv_backend="uv")
@nox.parametrize("django", DJANGO_VERSIONS)
def tests(session: nox.Session, django: str) -> None:
if (session.python, django) in INVALID_PYTHON_DJANGO_SESSIONS:
Expand All @@ -20,7 +21,7 @@ def tests(session: nox.Session, django: str) -> None:
session.run("pytest", *session.posargs)


@nox.session(python=["3.10"], tags=["drf"])
@nox.session(python=["3.10"], tags=["drf"], venv_backend="uv")
@nox.parametrize("django", ["3.2"])
@nox.parametrize("drf", DRF_VERSIONS)
def tests_drf(session: nox.Session, django: str, drf: str) -> None:
Expand Down
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ classifiers =
Framework :: Django :: 4.0
Framework :: Django :: 4.1
Framework :: Django :: 4.2
Framework :: Django :: 5.0
Framework :: Pytest
Intended Audience :: Developers
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand All @@ -39,10 +38,11 @@ include_package_data = True
packages = find:
zip_safe = False
setup_requires =
packaging
pytest-runner
pytest-django
tests_require = django-test-plus[test]
python_requires = >=3.6
python_requires = >=3.8

[options.entry_points]
pytest11 =
Expand All @@ -53,9 +53,9 @@ test =
factory-boy
flake8
pyflakes
pytest>=7.0
pytest-cov
pytest-django
pytest

[aliases]
test = pytest
Expand Down

0 comments on commit 9039f37

Please sign in to comment.