Skip to content

Commit

Permalink
Migrate to pytest as test runner
Browse files Browse the repository at this point in the history
- it works with the existing tests
- it's easy to select individual tests, and to split the test
  suite, "unittest discover" would as well but is more verbose and
  doesn't work in 2.7 (unittest2 is necessary)
- it has a really nice reporting
- I want to use pytest's nice everything e.g. could be useful to mark (and avoid running by default) slow tests, this sort of things

Closes #112
  • Loading branch information
masklinn committed May 1, 2022
1 parent f637a86 commit d72fff8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ jobs:
run: |
python -mpip install --upgrade pip
python -mpip install -r requirements_dev.txt
- name: tests
run: |
python setup.py develop
env time -v python ./ua_parser/user_agent_parser_test.py
- name: doctests
- name: install package in environment
run: python setup.py develop
- name: run tests
run: pytest
- name: run doctests
# pprint formatting was changed a lot in 3.5
if: ${{ matrix.python-version != '2.7' }}
run: python -mdoctest README.rst
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pytest
pyyaml~=5.4.0
tox==3.9.0
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ skipsdist = True
usedevelop = True
deps = -rrequirements_dev.txt
commands =
python ua_parser/user_agent_parser_test.py
pytest {posargs}
python -mdoctest README.rst

[testenv:py27]
# no doctesting in 2.7 because of formatting divergences
commands = python ua_parser/user_agent_parser_test.py
commands = pytest {posargs}

[testenv:docs]
skip_install = True
Expand Down

0 comments on commit d72fff8

Please sign in to comment.