|
| 1 | +How to contribute |
| 2 | +================= |
| 3 | + |
| 4 | +All contributions are greatly appreciated! |
| 5 | + |
| 6 | +How to report issues |
| 7 | +~~~~~~~~~~~~~~~~~~~~ |
| 8 | + |
| 9 | +Facilitating the work of potential contributors is recommended since it |
| 10 | +increases the likelihood of your issue being solved quickly. The few extra |
| 11 | +steps listed below will help clarify problems you might be facing: |
| 12 | + |
| 13 | +- Include a `minimal reproducible example`_ when possible. |
| 14 | +- Describe the expected behaviour and what actually happened including a full |
| 15 | + trace-back in case of exceptions. |
| 16 | +- Make sure to list details about your environment, such as your platform, |
| 17 | + versions of pytest, pytest-flask and python release. |
| 18 | + |
| 19 | +Also, it's important to check the current open issues for similar reports |
| 20 | +in order to avoid duplicates. |
| 21 | + |
| 22 | +.. _minimal reproducible example: https://stackoverflow.com/help/minimal-reproducible-example |
| 23 | + |
| 24 | +Setting up your development environment |
| 25 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 26 | + |
| 27 | +- Fork pytest-flask to your GitHub account by clicking the `Fork`_ button. |
| 28 | +- `Clone`_ the main repository (not your fork) to your local machine. |
| 29 | + |
| 30 | + .. code-block:: text |
| 31 | +
|
| 32 | + $ git clone https://github.com/pytest-dev/pytest-flask |
| 33 | + $ cd pytest-flask |
| 34 | +
|
| 35 | +- Add your fork as a remote to push your contributions.Replace |
| 36 | + ``{username}`` with your username. |
| 37 | + |
| 38 | + .. code-block:: text |
| 39 | +
|
| 40 | + git remote add fork https://github.com/{username}/pytest-flask |
| 41 | +
|
| 42 | +- Using `Tox`_, create a virtual environment and install pytest-flask in editable mode with development dependencies. |
| 43 | + |
| 44 | + .. code-block:: text |
| 45 | +
|
| 46 | + $ tox -e dev |
| 47 | + $ source venv/bin/activate |
| 48 | +
|
| 49 | +- Install pre-commit hooks |
| 50 | + |
| 51 | + .. code-block:: text |
| 52 | +
|
| 53 | + $ pre-commit install |
| 54 | +
|
| 55 | +.. _Fork: https://github.com/pytest-dev/pytest-flask/fork |
| 56 | +.. _Clone: https://help.github.com/en/articles/fork-a-repo#step-2-create-a-local-clone-of-your-fork |
| 57 | +.. _Tox: https://tox.readthedocs.io/en/latest/ |
| 58 | + |
| 59 | +Start Coding |
| 60 | +~~~~~~~~~~~~ |
| 61 | + |
| 62 | +- Create a new branch to identify what feature you are working on. |
| 63 | + |
| 64 | + .. code-block:: text |
| 65 | +
|
| 66 | + $ git fetch origin |
| 67 | + $ git checkout -b your-branch-name origin/master |
| 68 | +
|
| 69 | +- Make your changes |
| 70 | +- Include tests that cover any code changes you make and run them |
| 71 | + as described below. |
| 72 | +- Push your changes to your fork. |
| 73 | + `create a pull request`_ describing your changes. |
| 74 | + |
| 75 | + .. code-block:: text |
| 76 | +
|
| 77 | + $ git push --set-upstream fork your-branch-name |
| 78 | +
|
| 79 | +.. _create a pull request: https://help.github.com/en/articles/creating-a-pull-request |
| 80 | + |
| 81 | +How to run tests |
| 82 | +~~~~~~~~~~~~~~~~ |
| 83 | + |
| 84 | +You can run the test suite for the current environment with |
| 85 | + |
| 86 | + .. code-block:: text |
| 87 | +
|
| 88 | + $ pytest |
| 89 | +
|
| 90 | +To run the full test suite for all supported python versions |
| 91 | + |
| 92 | + .. code-block:: text |
| 93 | +
|
| 94 | + $ tox |
| 95 | +
|
| 96 | +Obs. CI will run tox when you submit your pull request, so this is optional. |
| 97 | + |
| 98 | +Checking Test Coverage |
| 99 | +~~~~~~~~~~~~~~~~~~~~~~~ |
| 100 | + |
| 101 | +To get a complete report of code sections not being touched by the |
| 102 | +test suite run ``pytest`` using ``coverage``. |
| 103 | + |
| 104 | +.. code-block:: text |
| 105 | +
|
| 106 | + $ coverage run -m pytest |
| 107 | + $ coverage html |
| 108 | +
|
| 109 | +Open ``htmlcov/index.html`` in your browser. |
| 110 | + |
| 111 | +More about converage `here <https://coverage.readthedocs.io>`__. |
0 commit comments