From 86cb004ec66a0fcefc195f30036cf3182e8346d3 Mon Sep 17 00:00:00 2001 From: Alexandre Muller Date: Thu, 11 Jan 2024 10:05:16 +0100 Subject: [PATCH] github: add CI for test using pytest --- .github/workflows/tests.yml | 42 +++++++++++++++++++++++++++++++++++++ dev_requirements.txt | 1 + pytest.ini | 4 ++++ tox.ini | 13 ++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 pytest.ini create mode 100644 tox.ini diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..312adc0 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,42 @@ +name: Tests + +on: push + +jobs: + build: + runs-on: ubuntu-latest + + name: Python ${{ matrix.python-version }} / ${{ matrix.django }} + strategy: + matrix: + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" + django: + - django32 + - django42 + - django50 + exclude: + - django: django50 + python-version: "3.8" + - django: django50 + python-version: "3.9" + - django: django32 + python-version: "3.11" + - django: django32 + python-version: "3.12" + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install --upgrade pip setuptools wheel + pip install tox + - name: Run tests + run: tox -v -e py-${{ matrix.django }} diff --git a/dev_requirements.txt b/dev_requirements.txt index c65a3c8..2e3746f 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,2 +1,3 @@ Django<5.1 django_testproject +pytest-django diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..d99faec --- /dev/null +++ b/pytest.ini @@ -0,0 +1,4 @@ +[pytest] +django_find_project = false +DJANGO_SETTINGS_MODULE = dj_pagination.tests.settings +pythonpath = . dj_pagination diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..056848a --- /dev/null +++ b/tox.ini @@ -0,0 +1,13 @@ +[tox] +envlist = + py{38,39}-django{32,42} + py{310}-django{32,42,50} + py{311,312}-django{42,50} + +[testenv] +commands = pytest -v -Wdefault::DeprecationWarning +deps = + -rdev_requirements.txt + django32: Django==3.2.* + django42: Django==4.2.* + django50: Django==5.0.*