Skip to content

Commit a922231

Browse files
committed
ci: testing via Tox
1 parent aebda49 commit a922231

File tree

6 files changed

+63
-20
lines changed

6 files changed

+63
-20
lines changed

.github/workflows/linting.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
name: Linting
22

33
on:
4-
push:
5-
6-
pull_request:
7-
# The branches below must be a subset of the branches above
8-
branches: [master]
4+
- push
5+
- pull_request
96

107
jobs:
118
linting:
129
runs-on: ubuntu-latest
10+
1311
steps:
1412
- uses: actions/checkout@v3
1513
- uses: actions/setup-python@v4

.github/workflows/tox.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Tox
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: ['3.9', '3.10', '3.11']
13+
14+
services:
15+
postgres:
16+
image: postgres
17+
env:
18+
POSTGRES_PASSWORD: postgres
19+
options: >-
20+
--health-cmd pg_isready
21+
--health-interval 10s
22+
--health-timeout 5s
23+
--health-retries 5
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Install poetry
32+
run: curl -sSL https://install.python-poetry.org | python3 -
33+
34+
- name: Install Tox
35+
run: python -m pip install tox tox-gh-actions
36+
37+
- name: Test with Tox
38+
run: tox

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Clone the repository, go to it's base directory and run the following commands.
148148

149149
Or if you want a specific environment
150150

151-
tox -e py35-dj2.0
151+
tox -e py311-dj41
152152

153153
## Authors
154154

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ psycopg2 = ">=2.8.4"
1515
[tool.poetry.group.dev.dependencies]
1616
flake8 = "^5.0.4"
1717
pylint = "^2.13.9"
18-
nose = "^1.3.7"
1918
pylint-django = ">=2.5.3"
2019
isort = "^5.10.1"
2120
pre-commit = "^2.9.2"
22-
django-nose = "^1.4.7"
2321
black = "^22.10.0"
2422
pytest = "^7.2.0"
2523
pytest-django = "^4.5.2"

tests/settings.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@
1919
INSTALLED_APPS = [
2020
"postgres_composite_types",
2121
"tests",
22-
"django_nose",
2322
]
2423

25-
TEST_RUNNER = "django_nose.NoseTestSuiteRunner"
26-
2724
# Database
2825
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
2926
DATABASES = {
@@ -32,6 +29,7 @@
3229
"NAME": "postgres",
3330
"USER": "postgres",
3431
"HOST": "localhost",
32+
"PASSWORD": "postgres",
3533
}
3634
}
3735

tox.ini

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
[tox]
2-
skipsdist = True
3-
envlist =
4-
py{35,36}-dj{1.11,2.0,2.1}
2+
envlist = py{39,310,311}-dj{32,40,41}
3+
isolated_build = true
54

65
[testenv]
7-
usedevelop = True
86
setenv =
9-
DJANGO_SETTINGS_MODULE=tests.settings
7+
PYTHONPATH = {toxinidir}
8+
DJANGO_SETTINGS_MODULE = tests.settings
9+
10+
allowlist_externals = pwd
11+
1012
commands =
11-
django-admin test
13+
pwd
14+
pytest tests/
1215

1316
deps =
14-
dj1.11: Django~=1.11.0
15-
dj2.0: Django~=2.0.0
16-
dj2.1: Django~=2.1.0
17+
pytest
18+
pytest-django
19+
dj32: Django >= 3.2.16
20+
dj40: Django >= 4.0.8
21+
dj41: Django >= 4.1.4
22+
23+
[gh-actions]
24+
python =
25+
3.9: py39
26+
3.10: py310
27+
3.11: py311

0 commit comments

Comments
 (0)