From 1dd7a53e9cf6895ada91537410b45be41ca28220 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Sat, 30 Nov 2024 16:56:31 +0100 Subject: [PATCH] chore: Update tests to avoid running `setup test` (#174) * Update test.yml * Update tox.ini * Update test.yml * Update tox.ini * Update settings.py * Update base.txt * Update tests/settings.py * Update tests/settings.py * Update README.rst * Update test.yml * Update test.yml * Update test.yml --- .github/workflows/test.yml | 24 ++++++++++++++++-------- README.rst | 4 ++-- tests/requirements/base.txt | 1 + tests/settings.py | 2 ++ tox.ini | 8 ++++---- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3521825..ab04e1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,12 +8,18 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10'] - django-version: ['3.2', '4.0', '4.1'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + django-version: ['3.2', '4.2', '5.0', '5.1'] os: [ - ubuntu-20.04, + ubuntu-latest ] - + exclude: + - django-version: '5.0' + python-version: '3.9' + - django-version: '5.1' + python-version: '3.9' + - django-version: '3.2' + python-version: '3.13' steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -23,11 +29,12 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install django==${{ matrix.django-version }} coverage + pip install django~=${{ matrix.django-version }} coverage + pip install -r tests/requirements/base.txt python setup.py install - name: Run coverage - run: coverage run setup.py test + run: coverage run tests/settings.py - name: Upload Coverage to Codecov uses: codecov/codecov-action@v1 @@ -43,7 +50,7 @@ jobs: 'https://github.com/django/django/archive/main.tar.gz' ] os: [ - ubuntu-20.04, + ubuntu-latest, ] steps: @@ -57,10 +64,11 @@ jobs: run: | python -m pip install --upgrade pip pip install ${{ matrix.django-version }} coverage + pip install -r tests/requirements/base.txt python setup.py install - name: Run coverage - run: coverage run setup.py test + run: coverage run tests/settings.py continue-on-error: true - name: Upload Coverage to Codecov diff --git a/README.rst b/README.rst index ccd7508..f4e0d18 100644 --- a/README.rst +++ b/README.rst @@ -72,7 +72,7 @@ You can run tests by executing:: .. |coverage| image:: https://codecov.io/gh/divio/django-sekizai/branch/master/graph/badge.svg :target: https://codecov.io/gh/divio/django-sekizai -.. |python| image:: https://img.shields.io/badge/python-3.5+-blue.svg +.. |python| image:: https://img.shields.io/badge/python-3.9+-blue.svg :target: https://pypi.org/project/django-sekizai/ -.. |django| image:: https://img.shields.io/badge/django-2.2,%203.0,%203.1-blue.svg +.. |django| image:: https://img.shields.io/badge/django-4.2,%205.0,%205.1-blue.svg :target: https://www.djangoproject.com/ diff --git a/tests/requirements/base.txt b/tests/requirements/base.txt index 9ec156a..76c9bd3 100644 --- a/tests/requirements/base.txt +++ b/tests/requirements/base.txt @@ -2,3 +2,4 @@ tox coverage flake8 +setuptools diff --git a/tests/settings.py b/tests/settings.py index c015961..1719f08 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -59,4 +59,6 @@ def run(): if __name__ == '__main__': + # Add current directory to python path - works if this script is called python tests/settings,.py + sys.path.insert(0, '.') run() diff --git a/tox.ini b/tox.ini index fe9a463..3a0a8fc 100644 --- a/tox.ini +++ b/tox.ini @@ -11,14 +11,14 @@ skip_missing_interpreters=True deps = -r{toxinidir}/tests/requirements/base.txt dj32: Django>=3.2,<3.3 - dj40: Django>=4.0,<4.1 - dj41: Django>=4.1,<4.2 - dj42: Django>=4.2,<5.0 + dj42: Django>=4.2,<4.3 + dj50: Django>=5.0,<5.1 + dj51: Django>=5.1,<5.2 djmain: https://github.com/django/django/archive/main.tar.gz commands = {envpython} --version {env:COMMAND:coverage} erase - {env:COMMAND:coverage} run setup.py test + {env:COMMAND:coverage} run tests/settings.py {env:COMMAND:coverage} report ignore_outcome = djmain: True