blob: 75ee3ec32d3ad162eb4e26b4a5c4e1baedaf2dc6 [file] [log] [blame]
Chad Duffinac9ac062019-07-23 10:06:45 -07001============================
2Contribution getting started
3============================
4
5Contributions are highly welcomed and appreciated. Every little help counts,
6so do not hesitate!
7
8.. contents:: Contribution links
9 :depth: 2
10
11
12.. _submitfeedback:
13
14Feature requests and feedback
15-----------------------------
16
17Do you like pytest? Share some love on Twitter or in your blog posts!
18
19We'd also like to hear about your propositions and suggestions. Feel free to
20`submit them as issues <https://github.com/pytest-dev/pytest/issues>`_ and:
21
22* Explain in detail how they should work.
23* Keep the scope as narrow as possible. This will make it easier to implement.
24
25
26.. _reportbugs:
27
28Report bugs
29-----------
30
31Report bugs for pytest in the `issue tracker <https://github.com/pytest-dev/pytest/issues>`_.
32
33If you are reporting a bug, please include:
34
35* Your operating system name and version.
36* Any details about your local setup that might be helpful in troubleshooting,
37 specifically Python interpreter version,
38 installed libraries and pytest version.
39* Detailed steps to reproduce the bug.
40
41If you can write a demonstration test that currently fails but should pass (xfail),
42that is a very useful commit to make as well, even if you can't find how
43to fix the bug yet.
44
45
46.. _fixbugs:
47
48Fix bugs
49--------
50
51Look through the GitHub issues for bugs. Here is sample filter you can use:
52https://github.com/pytest-dev/pytest/labels/bug
53
54:ref:`Talk <contact>` to developers to find out how you can fix specific bugs.
55
56Don't forget to check the issue trackers of your favourite plugins, too!
57
58.. _writeplugins:
59
60Implement features
61------------------
62
63Look through the GitHub issues for enhancements. Here is sample filter you
64can use:
65https://github.com/pytest-dev/pytest/labels/enhancement
66
67:ref:`Talk <contact>` to developers to find out how you can implement specific
68features.
69
70Write documentation
71-------------------
72
73pytest could always use more documentation. What exactly is needed?
74
75* More complementary documentation. Have you perhaps found something unclear?
76* Documentation translations. We currently have only English.
77* Docstrings. There can never be too many of them.
78* Blog posts, articles and such -- they're all very appreciated.
79
80You can also edit documentation files directly in the Github web interface
81without needing to make a fork and local copy. This can be convenient for
82small fixes.
83
84
85.. _submitplugin:
86
87Submitting Plugins to pytest-dev
88--------------------------------
89
90Pytest development of the core, some plugins and support code happens
91in repositories living under the ``pytest-dev`` organisations:
92
93- `pytest-dev on GitHub <https://github.com/pytest-dev>`_
94
95- `pytest-dev on Bitbucket <https://bitbucket.org/pytest-dev>`_
96
97All pytest-dev Contributors team members have write access to all contained
98repositories. pytest core and plugins are generally developed
99using `pull requests`_ to respective repositories.
100
101The objectives of the ``pytest-dev`` organisation are:
102
103* Having a central location for popular pytest plugins
104* Sharing some of the maintenance responsibility (in case a maintainer no longer whishes to maintain a plugin)
105
106You can submit your plugin by subscribing to the `pytest-dev mail list
107<https://mail.python.org/mailman/listinfo/pytest-dev>`_ and writing a
108mail pointing to your existing pytest plugin repository which must have
109the following:
110
111- PyPI presence with a ``setup.py`` that contains a license, ``pytest-``
112 prefixed name, version number, authors, short and long description.
113
114- a ``tox.ini`` for running tests using `tox <http://tox.testrun.org>`_.
115
116- a ``README.txt`` describing how to use the plugin and on which
117 platforms it runs.
118
119- a ``LICENSE.txt`` file or equivalent containing the licensing
120 information, with matching info in ``setup.py``.
121
122- an issue tracker for bug reports and enhancement requests.
123
124If no contributor strongly objects and two agree, the repository can then be
125transferred to the ``pytest-dev`` organisation.
126
127Here's a rundown of how a repository transfer usually proceeds
128(using a repository named ``joedoe/pytest-xyz`` as example):
129
130* One of the ``pytest-dev`` administrators creates:
131
132 - ``pytest-xyz-admin`` team, with full administration rights to
133 ``pytest-dev/pytest-xyz``.
134 - ``pytest-xyz-developers`` team, with write access to
135 ``pytest-dev/pytest-xyz``.
136
137* ``joedoe`` is invited to the ``pytest-xyz-admin`` team;
138
139* After accepting the invitation, ``joedoe`` transfers the repository from its
140 original location to ``pytest-dev/pytest-xyz`` (A nice feature is that GitHub handles URL redirection from
141 the old to the new location automatically).
142
143* ``joedoe`` is free to add any other collaborators to the
144 ``pytest-xyz-admin`` or ``pytest-xyz-developers`` team as desired.
145
146The ``pytest-dev/Contributors`` team has write access to all projects, and
147every project administrator is in it. We recommend that each plugin has at least three
148people who have the right to release to PyPI.
149
150Repository owners can be assured that no ``pytest-dev`` administrator will ever make
151releases of your repository or take ownership in any way, except in rare cases
152where someone becomes unresponsive after months of contact attempts.
153As stated, the objective is to share maintenance and avoid "plugin-abandon".
154
155
156.. _`pull requests`:
157.. _pull-requests:
158
159Preparing Pull Requests on GitHub
160---------------------------------
161
162There's an excellent tutorial on how Pull Requests work in the
163`GitHub Help Center <https://help.github.com/articles/using-pull-requests/>`_
164
165
166.. note::
167 What is a "pull request"? It informs project's core developers about the
168 changes you want to review and merge. Pull requests are stored on
169 `GitHub servers <https://github.com/pytest-dev/pytest/pulls>`_.
170 Once you send pull request, we can discuss it's potential modifications and
171 even add more commits to it later on.
172
173There's an excellent tutorial on how Pull Requests work in the
174`GitHub Help Center <https://help.github.com/articles/using-pull-requests/>`_,
175but here is a simple overview:
176
177#. Fork the
178 `pytest GitHub repository <https://github.com/pytest-dev/pytest>`__. It's
179 fine to use ``pytest`` as your fork repository name because it will live
180 under your user.
181
182#. Clone your fork locally using `git <https://git-scm.com/>`_ and create a branch::
183
184 $ git clone git@github.com:YOUR_GITHUB_USERNAME/pytest.git
185 $ cd pytest
186 # now, to fix a bug create your own branch off "master":
187
188 $ git checkout -b your-bugfix-branch-name master
189
190 # or to instead add a feature create your own branch off "features":
191
192 $ git checkout -b your-feature-branch-name features
193
194 Given we have "major.minor.micro" version numbers, bugfixes will usually
195 be released in micro releases whereas features will be released in
196 minor releases and incompatible changes in major releases.
197
198 If you need some help with Git, follow this quick start
199 guide: https://git.wiki.kernel.org/index.php/QuickStart
200
201#. Install tox
202
203 Tox is used to run all the tests and will automatically setup virtualenvs
204 to run the tests in.
205 (will implicitly use http://www.virtualenv.org/en/latest/)::
206
207 $ pip install tox
208
209#. Run all the tests
210
211 You need to have Python 2.7 and 3.5 available in your system. Now
212 running tests is as simple as issuing this command::
213
214 $ python runtox.py -e linting,py27,py35
215
216 This command will run tests via the "tox" tool against Python 2.7 and 3.5
217 and also perform "lint" coding-style checks. ``runtox.py`` is
218 a thin wrapper around ``tox`` which installs from a development package
219 index where newer (not yet released to pypi) versions of dependencies
220 (especially ``py``) might be present.
221
222#. You can now edit your local working copy.
223
224 You can now make the changes you want and run the tests again as necessary.
225
226 To run tests on py27 and pass options to pytest (e.g. enter pdb on failure)
227 to pytest you can do::
228
229 $ python runtox.py -e py27 -- --pdb
230
231 or to only run tests in a particular test module on py35::
232
233 $ python runtox.py -e py35 -- testing/test_config.py
234
235#. Commit and push once your tests pass and you are happy with your change(s)::
236
237 $ git commit -a -m "<commit message>"
238 $ git push -u
239
240 Make sure you add a CHANGELOG message, and add yourself to AUTHORS. If you
241 are unsure about either of these steps, submit your pull request and we'll
242 help you fix it up.
243
244#. Finally, submit a pull request through the GitHub website using this data::
245
246 head-fork: YOUR_GITHUB_USERNAME/pytest
247 compare: your-branch-name
248
249 base-fork: pytest-dev/pytest
250 base: master # if it's a bugfix
251 base: feature # if it's a feature
252
253