mattjegan / django-gamification

The missing Django Gamification Package
Other
166 stars 28 forks source link

Set pytest as test runner #31

Closed fgmacedo closed 6 years ago

fgmacedo commented 6 years ago

Setup of pytest to be used as the test runner. Closes https://github.com/mattjegan/django-gamification/issues/27.

You can start writing new tests using pytest style, and choose to migrate existing tests or leave as is since pytest can run unittest tests.

I've also configured coverage to use branch coverage:

$ pytest
========================================================================== test session starts ==========================================================================
platform linux -- Python 3.6.2, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
Django settings: example_app.settings (from ini file)
rootdir: /works/projects/django-gamification, inifile: pytest.ini
plugins: django-3.1.2, cov-2.5.1
collected 15 items                                                                                                                                                       

tests/test_models.py ..........
tests/test_signals.py .....

----------- coverage: platform linux, python 3.6.2-final-0 -----------
Name                            Stmts   Miss Branch BrPart  Cover   Missing
---------------------------------------------------------------------------
django_gamification/models.py     123      0     38     10    94%   35->38, 94->102, 102->108, 202->exit, 204->exit, 210->exit, 216->exit, 218->exit, 225->exit, 227->exit
---------------------------------------------------------------------------
TOTAL                             138      0     46     10    95%

2 files skipped due to complete coverage.

Required test coverage of 90% reached. Total coverage: 94.57%

With tox:

  py35-django18: commands succeeded
  py35-django19: commands succeeded
  py35-django110: commands succeeded
  py35-django111: commands succeeded
  py36-django18: commands succeeded
  py36-django19: commands succeeded
  py36-django110: commands succeeded
  py36-django111: commands succeeded
  congratulations :)
mattjegan commented 6 years ago

Awesome work, looks excellent to me 👍 +1 for updating the documentation also.