Skip to content

Commit

Permalink
Switch from nose to pynose
Browse files Browse the repository at this point in the history
pynose is an updated version of nose, with support for newer
versions of python. The lack of support for newer versions of
python was initially a reason to switch test frameworks, but
pynose enables retaining the most compatibility with the current
test framework while also enabling usage of newer python versions.
  • Loading branch information
gherceg committed Nov 17, 2023
1 parent 6747f49 commit 6187e30
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ jobs:
run: |
python --version
pip install --upgrade pip wheel
pip install django nose coverage
pip install django pynose coverage
- name: Run coverage
run: |
coverage run -m nose
# .coverage.* files are ignored by git
coverage report -m | tee .coverage.out
pynose --with-coverage --cover-erase --cover-package=field_audit | tee .coverage.out
percent=$(grep -E '^TOTAL\s.+\s[0-9]{1,3}%$' .coverage.out \
| awk '{gsub("%$", "", $NF); print($NF)}')
python scripts/make-coverage-badge.py -o .coverage.svg "$percent"
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
strategy:
fail-fast: false
matrix:
# TODO: switch to pytest to support 3.10 (nosetests is broken on 3.10)
python: ['3.9']
django:
- 'Django>=3.2,<3.3'
Expand Down Expand Up @@ -48,7 +47,7 @@ jobs:
run: |
python --version
pip install --upgrade pip wheel
pip install "${{ matrix.django }}" psycopg2-binary nose flake8 coverage
pip install "${{ matrix.django }}" psycopg2-binary pynose flake8 coverage
- name: Run tests
env:
DB_SETTINGS: >-
Expand All @@ -60,7 +59,7 @@ jobs:
"HOST":"localhost",
"PORT":"5432"
}
run: nosetests -v --with-coverage --cover-branches --cover-package=field_audit
run: pynose -v --with-coverage --cover-branches --cover-package=field_audit
continue-on-error: ${{ matrix.experimental }}
- name: Check migrations
run: |
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Create/activate a python virtualenv and install the required dependencies.
```shell
cd django-field-audit
mkvirtualenv django-field-audit # or however you choose to setup your environment
pip install django nose flake8 coverage
pip install django pynose flake8 coverage
```

### Running tests
Expand All @@ -221,7 +221,7 @@ your local Python's `sqlite3` library ships with the `JSON1` extension enabled

- Tests
```shell
nosetests
pynose
```

- Style check
Expand All @@ -231,8 +231,7 @@ your local Python's `sqlite3` library ships with the `JSON1` extension enabled

- Coverage
```shell
coverage run -m nose
coverage report -m
pynose --with-coverage --cover-erase --cover-package field_audit
```

### Adding migrations
Expand Down

0 comments on commit 6187e30

Please sign in to comment.