Skip to content

Commit

Permalink
Merge pull request #15 from rjw57/tweak-coverage-output
Browse files Browse the repository at this point in the history
Improve code coverage reporting
  • Loading branch information
rjw57 committed Jul 14, 2016
2 parents 55bd4e6 + 08d181e commit c62d933
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ db.sqlite3
docs/_build
staticfiles/
.coverage
htmlcov/
47 changes: 47 additions & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,50 @@ Notes on the test database
are *active*.
- Users ``test0100`` to ``test0199`` exist in the database but are not
CUED members.

Development
-----------

This section contains some important information if you're thinking of
developing a feature for the database.

Tests
'''''

The test suite for the mentoring database is run via the ``tox`` test-runner. If
you're intending to develop a feature for the database, it is important that you
write tests. By default, ``tox`` will run tests using whichever Python version
correspond to the installed ``python`` and ``python3`` binaries.

Install ``tox`` via pip:

.. code:: console
$ pip install --user tox
You can now run the tests via the ``tox`` command:

.. code:: console
$ tox
Any positional arguments are passed to the underlying invocation of ``manage.py
test`` and so you can specify a particular application to test by giving it's
directory. For example:

.. code:: console
$ tox edpcmentoring/cuedmembers
Code coverage
'''''''''''''

The tests are run under the ``coverage`` code-coverage utility and files which
do not have 100% test coverage are printed out after the tests are run.
Additionally, a HTML report is generated in ``htmlcov/`` which is useful for
determining which lines are untested.

Although 100% code coverage is probably infeasible in general, we aim for as
close as possible in the database. Pull requests which increase test code
coverage are welcome.

3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ deps=
commands=
coverage erase
coverage run edpcmentoring/manage.py test {posargs:edpcmentoring}
coverage report
coverage report --skip-covered
coverage html

# A testenv which uses whichever Python 3 is installed on the system
[testenv:py3]
Expand Down

0 comments on commit c62d933

Please sign in to comment.