Merge pull request #2343 from davidism/tests
Before adoption: this commit came in with the history the project adopted, so no landing records it.
update development resources
authored by David Lord · committed by GitHub · parents a37f675, 3c7625e · Browse files · 8 files·+188 added−116 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
8 files+188 added−116 removed
- other:+188 added−116 removed
Provenance
- Commit
9038914- Tree
160f050- Author
David Lord <davidism@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
a37f675- Parent 2
3c7625e
8 files changed+188 added−116 removed
modified:.github/ISSUE_TEMPLATE.rst+33 added-2 removed
1-The issue tracker is a tool to address bugs.2-Please use the #pocoo IRC channel on freenode or Stack Overflow for questions.1+**This issue tracker is a tool to address bugs in Flask itself.2+Please use the #pocoo IRC channel on freenode or Stack Overflow for general3+questions about using Jinja or issues not related to Jinja.**4+5+If you'd like to report a bug in Flask, fill out the template below. Provide6+any any extra information that may be useful / related to your problem.7+Ideally, create an [MCVE](http://stackoverflow.com/help/mcve), which helps us8+understand the problem and helps check that it is not caused by something in9+your code.10+11+---12+13+### Expected Behavior14+15+Tell us what should happen.16+17+```python18+Paste a minimal example that causes the problem.19+```20+21+### Actual Behavior22+23+Tell us what happens instead.24+25+```pytb26+Paste the full traceback if there was an exception.27+```28+29+### Environment30+31+* Python version:32+* Flask version:33+* Werkzeug version:added:.github/PULL_REQUEST_TEMPLATE.rst+16 added
1+Describe what this patch does to fix the issue.2+3+Link to any relevant issues or pull requests.4+5+<!--6+Commit checklist:7+8+* add tests that fail without the patch9+* ensure all tests pass with ``pytest``10+* add documentation to the relevant docstrings or pages11+* add ``versionadded`` or ``versionchanged`` directives to relevant docstrings12+* add a changelog entry if this patch changes code13+14+Tests, coverage, and docs will be run automatically when you submit the pull15+request, but running them yourself can save time.16+-->modified:docs/contents.rst.inc+1 added
57 unmodified lines58 python359 upgrading60 changelog61 license62+ contributingadded:docs/contributing.rst+1 added
1+.. include:: ../CONTRIBUTING.rstmodified:CONTRIBUTING.rst+93 added-92 removed
1-==========================1 How to contribute to Flask2 ==========================3 5-Thanks for considering contributing to Flask.4+Thank you for considering contributing to Flask!5 6 Support questions8-=================7+-----------------8 10-Please, don't use the issue tracker for this. Check whether the ``#pocoo`` IRC11-channel on Freenode can help with your issue. If your problem is not strictly12-Werkzeug or Flask specific, ``#python`` is generally more active.13-`Stack Overflow <https://stackoverflow.com/>`_ is also worth considering.9+Please, don't use the issue tracker for this. Use one of the following10+resources for questions about your own code:11 12+* The IRC channel ``#pocoo`` on FreeNode.13+* The IRC channel ``#python`` on FreeNode for more general questions.14+* The mailing list flask@python.org for long term discussion or larger issues.15+* Ask on `Stack Overflow`_. Search with Google first using:16+ ``site:stackoverflow.com flask {search term, exception message, etc.}``17+18+.. _Stack Overflow: https://stackoverflow.com/questions/tagged/flask?sort=linked19+20 Reporting issues16-================21+----------------22 18-- Under which versions of Python does this happen? This is even more important19- if your issue is encoding related.23+- Describe what you expected to happen.24+- If possible, include a `minimal, complete, and verifiable example`_ to help25+ us identify the issue. This also helps check that the issue is not with your26+ own code.27+- Describe what actually happened. Include the full traceback if there was an28+ exception.29+- List your Python, Flask, and Werkzeug versions. If possible, check if this30+ issue is already fixed in the repository.31 21-- Under which versions of Werkzeug does this happen? Check if this issue is22- fixed in the repository.32+.. _minimal, complete, and verifiable example: https://stackoverflow.com/help/mcve33 34 Submitting patches25-==================35+------------------36 37 - Include tests if your patch is supposed to solve a bug, and explain38 clearly under which circumstances the bug happens. Make sure the test fails39 without your patch.40+- Try to follow `PEP8`_, but you may ignore the line length limit if following41+ it would make the code uglier.42 31-- Try to follow `PEP8 <https://www.python.org/dev/peps/pep-0008/>`_, but you32- may ignore the line-length-limit if following it would make the code uglier.33-43 First time setup35-----------------44+~~~~~~~~~~~~~~~~45 46 - Download and install the `latest version of git`_.38-- Configure git with your `username`_ and `email`_.47+- Configure git with your `username`_ and `email`_::48+49+ git config --global user.name 'your name'50+ git config --global user.email 'your email'51+52 - Make sure you have a `GitHub account`_.53 - Fork Flask to your GitHub account by clicking the `Fork`_ button.41-- `Clone`_ your GitHub fork locally.42-- Add the main repository as a remote to update later.43- ``git remote add pallets https://github.com/pallets/flask``54+- `Clone`_ your GitHub fork locally::55 56+ git clone https://github.com/{username}/flask57+ cd flask58+59+- Add the main repository as a remote to update later::60+61+ git remote add pallets https://github.com/pallets/flask62+ git fetch pallets63+64+- Create a virtualenv::65+66+ python3 -m venv env67+ . env/bin/activate68+ # or "env\Scripts\activate" on Windows69+70+- Install Flask in editable mode with development dependencies::71+72+ pip install -e ".[dev]"73+74 .. _GitHub account: https://github.com/join75 .. _latest version of git: https://git-scm.com/downloads76 .. _username: https://help.github.com/articles/setting-your-username-in-git/77 .. _email: https://help.github.com/articles/setting-your-email-in-git/78 .. _Fork: https://github.com/pallets/flask/pull/2305#fork-destination-box79 .. _Clone: https://help.github.com/articles/fork-a-repo/#step-2-create-a-local-clone-of-your-fork80 81 Start coding53-------------82+~~~~~~~~~~~~83 84 - Create a branch to identify the issue you would like to work on (e.g.85 ``2287-dry-test-suite``)86 - Using your favorite editor, make your changes, `committing as you go`_.9 unmodified lines96 .. _create a pull request: https://help.github.com/articles/creating-a-pull-request/97 98 .. _contributing-testsuite:99 71-Running the testsuite72----------------------100+Running the tests101+~~~~~~~~~~~~~~~~~102 74-You probably want to set up a `virtualenv75-<https://virtualenv.readthedocs.io/en/latest/index.html>`_.103+Run the basic test suite with::104 77-The minimal requirement for running the testsuite is ``pytest``. You can78-install it with::105+ pytest106 80- pip install pytest107+This only runs the tests for the current environment. Whether this is relevant108+depends on which part of Flask you're working on. Travis-CI will run the full109+suite when you submit your pull request.110 82-Clone this repository::111+The full test suite takes a long time to run because it tests multiple112+combinations of Python and dependencies. You need to have Python 2.6, 2.7, 3.3,113+3.4, 3.5 3.6, and PyPy 2.7 installed to run all of the environments. Then run::114 84- git clone https://github.com/pallets/flask.git115+ tox116 86-Install Flask as an editable package using the current source::87-88- cd flask89- pip install --editable .90-91-Running the testsuite92----------------------93-94-The minimal requirement for running the testsuite is ``pytest``. You can95-install it with::96-97- pip install pytest98-99-Then you can run the testsuite with::100-101- pytest tests/102-103-**Shortcut**: ``make test`` will ensure ``pytest`` is installed, and run it.104-105-With only pytest installed, a large part of the testsuite will get skipped106-though. Whether this is relevant depends on which part of Flask you're working107-on. Travis is set up to run the full testsuite when you submit your pull108-request anyways.109-110-If you really want to test everything, you will have to install ``tox`` instead111-of ``pytest``. You can install it with::112-113- pip install tox114-115-The ``tox`` command will then run all tests against multiple combinations116-Python versions and dependency versions.117-118-**Shortcut**: ``make tox-test`` will ensure ``tox`` is installed, and run it.119-117 Running test coverage121----------------------122-Generating a report of lines that do not have unit test coverage can indicate where123-to start contributing. ``pytest`` integrates with ``coverage.py``, using the ``pytest-cov``124-plugin. This assumes you have already run the testsuite (see previous section)::118+~~~~~~~~~~~~~~~~~~~~~119 126- pip install pytest-cov120+Generating a report of lines that do not have test coverage can indicate121+where to start contributing. Run ``pytest`` using ``coverage`` and generate a122+report on the terminal and as an interactive HTML document::123 128-After this has been installed, you can output a report to the command line using this command::124+ coverage run -m pytest125+ coverage report126+ coverage html127+ # then open htmlcov/index.html128 130- pytest --cov=flask tests/129+Read more about `coverage <https://coverage.readthedocs.io>`_.130 132-Generate a HTML report can be done using this command::131+Running the full test suite with ``tox`` will combine the coverage reports132+from all runs.133 134- pytest --cov-report html --cov=flask tests/134+``make`` targets135+~~~~~~~~~~~~~~~~136 136-Full docs on ``coverage.py`` are here: https://coverage.readthedocs.io137+Flask provides a ``Makefile`` with various shortcuts. They will ensure that138+all dependencies are installed.139 138-**Shortcut**: ``make cov`` will ensure ``pytest-cov`` is installed, run it, display the results, *and* save the HTML report.140+- ``make test`` runs the basic test suite with ``pytest``141+- ``make cov`` runs the basic test suite with ``coverage``142+- ``make test-all`` runs the full test suite with ``tox``143+- ``make docs`` builds the HTML documentation144 145+Caution: zero-padded file modes146+-------------------------------147 141-Caution142-=======143-pushing144--------145-This repository contains several zero-padded file modes that may cause issues when pushing this repository to git hosts other than github. Fixing this is destructive to the commit history, so we suggest ignoring these warnings. If it fails to push and you're using a self-hosted git service like Gitlab, you can turn off repository checks in the admin panel.148+This repository contains several zero-padded file modes that may cause issues149+when pushing this repository to git hosts other than GitHub. Fixing this is150+destructive to the commit history, so we suggest ignoring these warnings. If it151+fails to push and you're using a self-hosted git service like GitLab, you can152+turn off repository checks in the admin panel.153 154+These files can also cause issues while cloning. If you have ::155 148-cloning149--------150-The zero-padded file modes files above can cause issues while cloning, too. If you have151-152-::153-156 [fetch]157 fsckobjects = true158 157-or159+or ::160 159-::160-161 [receive]162 fsckObjects = true163 164-165-set in your git configuration file, cloning this repository will fail. The only solution is to set both of the above settings to false while cloning, and then setting them back to true after the cloning is finished.164+set in your git configuration file, cloning this repository will fail. The only165+solution is to set both of the above settings to false while cloning, and then166+setting them back to true after the cloning is finished.modified:Makefile+22 added-14 removed
1-.PHONY: clean-pyc ext-test test tox-test test-with-mem upload-docs docs audit1+.PHONY: all install-dev test coverage cov test-all tox docs audit release clean-pyc upload-docs ebook2 3-all: clean-pyc test3+all: test4 5-test:6- pip install -r test-requirements.txt7- tox -e py-release5+install-dev:6+ pip install -q -e .[dev]7 9-cov:10- pip install -r test-requirements.txt -q11- FLASK_DEBUG= py.test --cov-report term --cov-report html --cov=flask --cov=examples tests examples8+test: clean-pyc install-dev9+ pytest10 11+coverage: clean-pyc install-dev12+ pip install -q -e .[test]13+ coverage run -m pytest14+ coverage report15+ coverage html16+17+cov: coverage18+19+test-all: install-dev20+ tox21+22+tox: test-all23+24+docs: clean-pyc install-dev25+ $(MAKE) -C docs html26+27 audit:28 python setup.py audit29 30 release:31 python scripts/make-release.py32 19-ext-test:20- python tests/flaskext_test.py --browse21-33 clean-pyc:34 find . -name '*.pyc' -exec rm -f {} +35 find . -name '*.pyo' -exec rm -f {} +36 find . -name '*~' -exec rm -f {} +13 unmodified lines50 @echo 'Command `ebook-covert` is provided by calibre package.'51 @echo 'Requires X-forwarding for Qt features used in conversion (ssh -X).'52 @echo 'Do not mind "Invalid value for ..." CSS errors if .mobi renders.'53 ssh -X pocoo.org ebook-convert /var/www/flask.pocoo.org/docs/flask-docs.epub /var/www/flask.pocoo.org/docs/flask-docs.mobi --cover http://flask.pocoo.org/docs/_images/logo-full.png --authors 'Armin Ronacher'43-44-docs:45- $(MAKE) -C docs htmlmodified:setup.py+11 added-2 removed
46 unmodified lines47 import re48 import ast49 from setuptools import setup50 51-51 _version_re = re.compile(r'__version__\s+=\s+(.*)')52 53 with open('flask/__init__.py', 'rb') as f:54 version = str(ast.literal_eval(_version_re.search(55 f.read().decode('utf-8')).group(1)))56 58-57 setup(58 name='Flask',59 version=version,60 url='https://github.com/pallets/flask/',12 unmodified lines73 'Jinja2>=2.4',74 'itsdangerous>=0.21',75 'click>=4.0',76 ],77+ extras_require={78+ 'dev': [79+ 'blinker',80+ 'greenlet',81+ 'pytest>=3',82+ 'coverage',83+ 'tox',84+ 'sphinx',85+ 'sphinxcontrib-log-cabinet'86+ ],87+ },88 classifiers=[89 'Development Status :: 4 - Beta',90 'Environment :: Web Environment',91 'Intended Audience :: Developers',18 unmodified linesmodified:tox.ini+11 added-6 removed
1 [tox]2 envlist =3- py{36,35,34,33,27,26,py}-release4- py{36,27,py}-release-simplejson3+ py{36,35,34,33,27,26,py}4+ py{36,27,py}-simplejson5 py{36,33,27,26,py}-devel6 py{36,33,27,26,py}-lowest7 docs-html8 coverage-report25 unmodified lines34 pip install -e examples/minitwit -q35 pip install -e examples/patterns/largerapp -q36 37 # pytest-cov doesn't seem to play nice with -p38- coverage run -p -m pytest38+ coverage run -p -m pytest tests examples39 40 [testenv:docs-html]41-deps =42- sphinx43- flask-sphinx-themes41+deps = sphinx42 commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html43 44 [testenv:docs-linkcheck]45 deps = sphinx14 unmodified lines60 commands =61 coverage combine62 coverage report63 codecov64+65+[testenv:detox]66+skip_install = true67+deps = detox68+commands =69+ detox -e py{36,35,34,33,27,26,py},py{36,27,py}-simplejson,py{36,33,27,26,py}-devel,py{36,33,27,26,py}-lowest,docs-html70+ tox -e coverage-report