Skip to content

Commit 97f9e69

Browse files
authored
Add contribution guidelines (#124)
1 parent ab30863 commit 97f9e69

File tree

2 files changed

+122
-1
lines changed

2 files changed

+122
-1
lines changed

CONTRIBUTING.rst

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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>`__.

tox.ini

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ pep8ignore =
1010
pep8maxlinelength = 119
1111
junit_family=xunit2
1212

13+
[testenv:dev]
14+
commands =
15+
envdir = venv
16+
deps=
17+
-rrequirements/main.txt
18+
-rrequirements/test.txt
19+
-rrequirements/docs.txt
20+
pre-commit>=1.11.0
21+
tox
22+
basepython = python3.7
23+
usedevelop = True
1324

1425
[testenv]
1526
usedevelop = True
@@ -25,7 +36,6 @@ commands =
2536
--cov-report xml --cov pytest_flask \
2637
--cov-report=html \
2738
--cov-report term-missing \
28-
--pep8 \
2939
-ra \
3040
{posargs:tests}
3141

0 commit comments

Comments
 (0)