Skip to content

Commit b8a3982

Browse files
author
Dmitriy Gumeniuk
authored
Merge pull request #258 from iivanou/update_contribution
Update contribution guidelines
2 parents 3bd4681 + 6e5da3b commit b8a3982

File tree

5 files changed

+159
-64
lines changed

5 files changed

+159
-64
lines changed

CONTRIBUTING.rst

Lines changed: 110 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,146 @@
11
============
2-
Contributing
2+
Contribution
33
============
44

5-
Contributions are welcome, and they are greatly appreciated! Every
6-
little bit helps, and credit will always be given.
5+
Contributions are highly welcomed and appreciated.
76

8-
You can contribute in many ways:
7+
.. contents::
8+
:depth: 2
9+
:backlinks: none
910

10-
Types of Contributions
11-
----------------------
11+
Feature requests
12+
----------------
1213

13-
Report Bugs
14-
~~~~~~~~~~~
14+
We'd also like to hear about your thoughts and suggestions. Feel free to
15+
`submit them as issues <hhttps://github.com/reportportal/agent-python-pytest/issues>`_ and:
1516

16-
Report bugs at https://github.com/reportportal/agent-python-pytest/issues.
17+
* Explain in detail how they should work.
18+
* Keep the scope as narrow as possible. It will make it easier to implement.
1719

18-
If you are reporting a bug, please include:
20+
Bug reports
21+
-----------
22+
23+
Report bugs for the agent in the `issue tracker <https://github.com/reportportal/agent-python-pytest/issues>`_.
24+
25+
If you are reporting a new bug, please include:
1926

2027
* Your operating system name and version.
21-
* Any details about your local setup that might be helpful in troubleshooting.
28+
* Python interpreter version, installed libraries, reportportal-client, and agent-python-pytest
29+
version.
2230
* Detailed steps to reproduce the bug.
2331

24-
Fix Bugs
25-
~~~~~~~~
32+
Bug fixes
33+
---------
34+
35+
Look through the `GitHub issues for bugs <https://github.com/reportportal/agent-python-pytest/labels/bug>`_.
36+
37+
If you are gonna fix any of existing bugs, assign that bug to yourself and specify preliminary milestones.
38+
Talk to `contributors <https://github.com/reportportal/agent-python-pytest/graphs/contributors>`_ in case you need a
39+
consultancy regarding implementation.
40+
41+
Implement features
42+
------------------
43+
44+
Look through the `GitHub issues for enhancements <https://github.com/reportportal/agent-python-pytest/labels/enhancement>`_.
45+
46+
Talk to `contributors <https://github.com/reportportal/agent-python-pytest/graphs/contributors>`_ in case you need a
47+
consultancy regarding implementation.
48+
49+
Preparing Pull Requests
50+
-----------------------
51+
52+
What is a "pull request"? It informs the project's core developers about the
53+
changes you want to review and merge. Pull requests are stored on
54+
`GitHub servers <https://github.com/reportportal/agent-python-pytest/pulls>`_.
55+
Once you send a pull request, we can discuss its potential modifications and
56+
even add more commits to it later on. There's an excellent tutorial on how Pull
57+
Requests work in the
58+
`GitHub Help Center <https://help.github.com/articles/using-pull-requests/>`_.
59+
60+
Here is a simple overview below:
61+
62+
#. Fork the
63+
`agent-python-pytest GitHub repository <https://github.com/reportportal/agent-python-pytest>`_.
64+
65+
#. Clone your fork locally using `git <https://git-scm.com/>`_ and create a branch::
66+
67+
$ git clone [email protected]:YOUR_GITHUB_USERNAME/agent-python-pytest.git
68+
$ cd agent-python-pytest
69+
# now, create your own branch off the "master":
70+
71+
$ git checkout -b your-bugfix-branch-name
72+
73+
If you need some help with Git, follow this quick start
74+
guide: https://git.wiki.kernel.org/index.php/QuickStart
75+
76+
#. Install `pre-commit <https://pre-commit.com>`_ and its hook on the agent-python-pytest repo:
77+
78+
**Note: pre-commit must be installed as admin, as it will not function otherwise**::
79+
80+
81+
$ pip install --user pre-commit
82+
$ pre-commit install
83+
84+
Afterwards ``pre-commit`` will run whenever you commit.
85+
86+
https://pre-commit.com/ is a framework for managing and maintaining multi-language pre-commit hooks
87+
to ensure code-style and code formatting is consistent.
88+
89+
#. Install tox
2690

27-
Look through the GitHub issues for bugs. Anything tagged with "bug"
28-
and "help wanted" is open to whoever wants to implement it.
91+
Tox is used to run all the tests and will automatically setup virtualenvs
92+
to run the tests in.
93+
(will implicitly use http://www.virtualenv.org/en/latest/)::
2994

30-
Implement Features
31-
~~~~~~~~~~~~~~~~~~
95+
$ pip install tox
3296

33-
Look through the GitHub issues for features. Anything tagged with "enhancement"
34-
and "help wanted" is open to whoever wants to implement it.
97+
#. Run all the tests
3598

36-
Write Documentation
37-
~~~~~~~~~~~~~~~~~~~
99+
You need to have Python 3.6 available in your system. Now
100+
running tests is as simple as issuing this command::
38101

39-
agent-python-pytest could always use more documentation, whether as part of the
40-
official agent-python-pytest docs, in docstrings, or even on the web in blog posts,
41-
articles, and such.
102+
$ tox -e pep,py36
42103

43-
Submit Feedback
44-
~~~~~~~~~~~~~~~
104+
This command will run tests via the "tox" tool against Python 3.6
105+
and also perform code style checks.
45106

46-
The best way to send feedback is to file an issue at https://github.com/reportportal/agent-python-pytest/issues.
107+
#. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 recommendations.
47108

48-
If you are proposing a feature:
109+
You can pass different options to ``tox``. For example, to run tests on Python 3.6 and pass options to pytest
110+
(e.g. enter pdb on failure) to pytest you can do::
49111

50-
* Explain in detail how it would work.
51-
* Keep the scope as narrow as possible, to make it easier to implement.
52-
* Remember that this is a volunteer-driven project, and that contributions
53-
are welcome :)
112+
$ tox -e py36 -- --pdb
54113

55-
Get Started!
56-
------------
114+
Or to only run tests in a particular test module on Python 3.6::
57115

58-
Ready to contribute? Here's how to set up `agent-python-pytest` for local development.
116+
$ tox -e py36 -- tests/test_service.py
59117

60-
1. Fork the `agent-python-pytest` repo on GitHub.
61-
2. Clone your fork locally::
62118

63-
$ git clone [email protected]:your_name_here/agent-python-pytest
119+
When committing, ``pre-commit`` will re-format the files if necessary.
64120

65-
3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development::
121+
#. If instead of using ``tox`` you prefer to run the tests directly, then we suggest to create a virtual environment and use
122+
an editable install with the ``testing`` extra::
66123

67-
$ mkvirtualenv agent_python_pytest
68-
$ cd agent_python_pytest/
69-
$ python setup.py develop
124+
$ python3 -m venv .venv
125+
$ source .venv/bin/activate # Linux
126+
$ .venv/Scripts/activate.bat # Windows
127+
$ pip install -e ".[testing]"
70128

71-
4. Create a branch for local development::
129+
Afterwards, you can edit the files and run pytest normally::
72130

73-
$ git checkout -b name-of-your-bugfix-or-feature
131+
$ pytest tests/test_service.py
74132

75-
Now you can make your changes locally.
76133

77-
5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
134+
#. Commit and push once your tests pass and you are happy with your change(s)::
78135

79-
$ flake8 agent_python_pytest tests
80-
$ tox
136+
$ git commit -m "<commit message>"
137+
$ git push -u
81138

82-
To get flake8 and tox, just pip install them into your virtualenv.
83139

84-
6. Commit your changes and push your branch to GitHub::
140+
#. Finally, submit a pull request through the GitHub website using this data::
85141

86-
$ git add .
87-
$ git commit -m "Your detailed description of your changes."
88-
$ git push origin name-of-your-bugfix-or-feature
142+
head-fork: YOUR_GITHUB_USERNAME/agent-python-pytest
143+
compare: your-branch-name
89144

90-
7. Submit a pull request through the GitHub website.
145+
base-fork: reportportal/agent-python-pytest
146+
base: master

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Contribution
4343
All the fixes for the agent that supports Report Portal versions below 5.0.0 should go into the v1 branch.
4444
The master branch will store the code base for the agent for Report Portal versions 5 and above.
4545

46+
Look through the CONTRIBUTING.rst for contribution guidelines.
4647

4748
Configuration
4849
~~~~~~~~~~~~~

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[build-system]
2+
requires = [
3+
# sync with setup.py until we discard non-pep-517/518
4+
"setuptools>=40.0",
5+
"setuptools-scm",
6+
"wheel",
7+
]
8+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010

1111
def read_file(fname):
12-
"""
13-
Read file.
12+
"""Read the given file.
1413
15-
:param fname: string of filename
16-
:return: File descriptor
14+
:param fname: Filename to be read
15+
:return: File content
1716
"""
1817
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
1918
return f.read()
@@ -43,10 +42,5 @@ def read_file(fname):
4342
'pytest11': [
4443
'pytest_reportportal = pytest_reportportal.plugin',
4544
]
46-
},
47-
setup_requires=['pytest-runner'],
48-
tests_require=[
49-
'pytest',
50-
'delayed-assert'
51-
]
45+
}
5246
)

tox.ini

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[tox]
2+
isolated_build = True
3+
envlist =
4+
pep
5+
py27
6+
py35
7+
py36
8+
py37
9+
py38
10+
11+
[testenv]
12+
deps =
13+
pytest
14+
pytest-cov
15+
delayed-assert
16+
commands = pytest --cov=pytest_reportportal --cov-report=xml tests/ -s -vv
17+
18+
[testenv:pep]
19+
skip_install = True
20+
deps = pre-commit>=1.11.0
21+
commands = pre-commit run --all-files --show-diff-on-failure
22+
23+
[testenv:py27]
24+
deps =
25+
mock
26+
pytest
27+
pytest-cov
28+
delayed-assert
29+
30+
[gh-actions]
31+
python =
32+
2.7: py27
33+
3.5: py35
34+
3.6: pep, py36
35+
3.7: py37
36+
3.8: py38

0 commit comments

Comments
 (0)