diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 22828608..86aa7578 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -24,6 +24,13 @@ Reporting issues Submitting patches ================== +- Include tests if your patch is supposed to solve a bug, and explain + clearly under which circumstances the bug happens. Make sure the test fails + without your patch. + +- Try to follow `PEP8 `_, but you + may ignore the line-length-limit if following it would make the code uglier. + First time setup ---------------- @@ -81,10 +88,20 @@ Install Flask as an editable package using the current source:: cd flask pip install --editable . +Running the testsuite +--------------------- + +The minimal requirement for running the testsuite is ``pytest``. You can +install it with:: + + pip install pytest + Then you can run the testsuite with:: pytest tests/ +**Shortcut**: ``make test`` will ensure ``pytest`` is installed, and run it. + With only pytest installed, a large part of the testsuite will get skipped though. Whether this is relevant depends on which part of Flask you're working on. Travis is set up to run the full testsuite when you submit your pull @@ -98,6 +115,8 @@ of ``pytest``. You can install it with:: The ``tox`` command will then run all tests against multiple combinations Python versions and dependency versions. +**Shortcut**: ``make tox-test`` will ensure ``tox`` is installed, and run it. + Running test coverage --------------------- Generating a report of lines that do not have unit test coverage can indicate where @@ -116,6 +135,9 @@ Generate a HTML report can be done using this command:: Full docs on ``coverage.py`` are here: https://coverage.readthedocs.io +**Shortcut**: ``make cov`` will ensure ``pytest-cov`` is installed, run it, display the results, *and* save the HTML report. + + Caution ======= pushing diff --git a/Makefile b/Makefile index f76c2099..9a0a1696 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,10 @@ test: pip install -r test-requirements.txt tox -e py-release +cov: + pip install -r test-requirements.txt -q + FLASK_DEBUG= py.test --cov-report term --cov-report html --cov=flask --cov=examples tests examples + audit: python setup.py audit diff --git a/test-requirements.txt b/test-requirements.txt index 053148f8..edf1abb9 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1,3 @@ tox +pytest +pytest-cov \ No newline at end of file