diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 35d6195..c467ef9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,16 +7,16 @@ on: branches: [ main ] jobs: - build: + tests: + name: run tests for python ${{ matrix.python }}, django ${{ matrix.django }}, ${{ matrix.database }} runs-on: ubuntu-latest - services: postgres: image: postgres env: - POSTGRES_USER: 'test' - POSTGRES_PASSWORD: 'test' - POSTGRES_DB: 'test' + POSTGRES_DB: "test" + POSTGRES_USER: "test" + POSTGRES_PASSWORD: "test" options: >- --health-cmd pg_isready --health-interval 10s @@ -24,33 +24,45 @@ jobs: --health-retries 5 ports: - 5432:5432 - strategy: - max-parallel: 4 matrix: - python-version: [3.7, 3.9, '3.10'] - db: ["sqlite", "postgres"] - django-version: [2.2, 3.2, "4.0b1"] + python: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] + django: [ "3.2", "4.1", "4.2", "5.0" ] + database: [ "sqlite", "postgres" ] exclude: - - python-version: 3.7 - db: sqlite - django-version: "4.0b1" - - python-version: 3.7 - db: postgres - django-version: "4.0b1" + - python: "3.11" + django: "3.2" + - python: "3.12" + django: "3.2" + - python: "3.12" + django: "4.1" + - python: "3.8" + django: "5.0" + - python: "3.9" + django: "5.0" + steps: + - name: checkout repository + uses: actions/checkout@v4 + - name: install python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - name: install tox + run: python3 -m pip install tox tox-gh + - name: run tests + run: tox -e py${{ matrix.python }}-django${{ matrix.django }}-${{ matrix.database }} + lint: + name: check for any style errors + runs-on: ubuntu-latest steps: - # Python & dependency installation - - uses: actions/checkout@v2 - - name: setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: install dependencies - run: pip install --pre Django==${{ matrix.django-version }} markdown docutils psycopg2-binary - # - name: lint with flake8 - # run: flake8 --show-source --statistics --ignore=E203,E501,W503 - - name: make executable - run: chmod a+x run_tests.sh - - name: run tests - run: ./run_tests.sh + - name: checkout repository + uses: actions/checkout@v4 + - name: install python 3.11 + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: install tox + run: python3 -m pip install tox + - name: run linter + run: tox -e flake8 diff --git a/markupfield/tests/settings.py b/markupfield/tests/settings.py index fb3be75..4214a00 100644 --- a/markupfield/tests/settings.py +++ b/markupfield/tests/settings.py @@ -10,8 +10,10 @@ "default": { "ENGINE": "django.db.backends.postgresql_psycopg2", "NAME": "test", - "USER": "postgres", - "PASSWORD": "", + "USER": "test", + "PASSWORD": "test", + "HOST": "127.0.0.1", + "PORT": "5432", } } else: diff --git a/markupfield/tests/tests.py b/markupfield/tests/tests.py index 5ba9c5f..6a19151 100644 --- a/markupfield/tests/tests.py +++ b/markupfield/tests/tests.py @@ -386,7 +386,7 @@ def test_form_create(self): form.save() actual = Post.objects.get(title=self.data["title"]) - self.assertEquals(actual.body.raw, self.data["body"]) + self.assertEqual(actual.body.raw, self.data["body"]) def test_form_update(self): existing = Post.objects.create( @@ -404,7 +404,7 @@ def test_form_update(self): form.save() actual = Post.objects.get(title=update["title"]) - self.assertEquals(actual.body.raw, update["body"]) + self.assertEqual(actual.body.raw, update["body"]) class MarkupFieldLocalFileTestCase(TestCase): diff --git a/tox.ini b/tox.ini index 953b562..53489b9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,19 +1,44 @@ [tox] -envlist = py37-django{22,30}, flake8 +envlist = + ; python releases: https://www.python.org/downloads/ + ; django releases: https://www.djangoproject.com/download/ + ; python+django support: https://docs.djangoproject.com/en/dev/faq/install/ + py{38,39,310}-django3.2-{sqlite,postgres}, + py{38,39,310,311}-django4.1-{sqlite,postgres}, + py{38,39,310,311,312}-django4.2-{sqlite,postgres}, + py{310,311,312}-django5.0-{sqlite,postgres}, + flake8 [testenv:flake8] deps = flake8 -commands = flake8 --ignore=E402,E731 honeypot +commands = flake8 --ignore=E402,W503,E731 markupfield [testenv] +allowlist_externals = + ./run_tests.sh +commands = + ./run_tests.sh deps = - django22: Django==2.2 - django30: Django==3.0 + django3.2: Django ~= 3.2.9 + django4.1: Django ~= 4.1.3 + django4.2: Django ~= 4.2.0 + django5.0: Django ~= 5.0.0 markdown docutils psycopg2-binary -commands = ./run_tests.sh pip_pre = True +setenv = + postgres: DB = postgres + sqlite: DB = sqlite [flake8] max-line-length=99 + +[gh] +python = + ; https://github.com/tox-dev/tox-gh + 3.8 = py38 + 3.9 = py39 + 3.10 = py310 + 3.11 = py311 + 3.12 = py312