|
| 1 | +# Contribution |
| 2 | + |
| 3 | +Contributions are highly welcomed and appreciated. |
| 4 | + |
| 5 | +## Contents |
| 6 | + |
| 7 | +- [Feature requests](#feature-requests) |
| 8 | +- [Bug reports](#bug-reports) |
| 9 | +- [Bug fixes](#bug-fixes) |
| 10 | +- [Implement features](#implement-features) |
| 11 | +- [Preparing Pull Requests](#preparing-pull-requests) |
| 12 | + |
| 13 | +## Feature requests |
| 14 | + |
| 15 | +We'd also like to hear about your thoughts and suggestions. Feel free to [submit them as issues](https://github.com/reportportal/agent-Python-RobotFramework/issues) and: |
| 16 | + |
| 17 | +* Explain in detail how they should work. |
| 18 | +* Keep the scope as narrow as possible. It will make it easier to implement. |
| 19 | + |
| 20 | +## Bug reports |
| 21 | + |
| 22 | +Report bugs for the agent in the [issue tracker](https://github.com/reportportal/agent-Python-RobotFramework/issues). |
| 23 | + |
| 24 | +If you are reporting a new bug, please include: |
| 25 | + |
| 26 | +* Your operating system name and version. |
| 27 | +* Python interpreter version, installed libraries, reportportal-client, and agent-Python-RobotFramework version. |
| 28 | +* Detailed steps to reproduce the bug. |
| 29 | + |
| 30 | +## Bug fixes |
| 31 | + |
| 32 | +Look through the [GitHub issues for bugs](https://github.com/reportportal/agent-Python-RobotFramework/labels/bug). |
| 33 | + |
| 34 | +If you are going to fix any of existing bugs, assign that bug to yourself and specify preliminary milestones. Talk to [contributors](https://github.com/reportportal/agent-Python-RobotFramework/graphs/contributors) in case you need a consultancy regarding implementation. |
| 35 | + |
| 36 | +## Implement features |
| 37 | + |
| 38 | +Look through the [GitHub issues for enhancements](https://github.com/reportportal/agent-Python-RobotFramework/labels/enhancement). |
| 39 | + |
| 40 | +Talk to [contributors](https://github.com/reportportal/agent-Python-RobotFramework/graphs/contributors) in case you need a consultancy regarding implementation. |
| 41 | + |
| 42 | +## Preparing Pull Requests |
| 43 | + |
| 44 | +What is a "pull request"? It informs the project's core developers about the changes you want to review and merge. Pull requests are stored on [GitHub servers](https://github.com/reportportal/agent-Python-RobotFramework/pulls). Once you send a pull request, we can discuss its potential modifications and even add more commits to it later on. There's an excellent tutorial on how Pull Requests work in the [GitHub Help Center](https://help.github.com/articles/using-pull-requests/). |
| 45 | + |
| 46 | +Here is a simple overview below: |
| 47 | + |
| 48 | +1. Fork the [agent-Python-RobotFramework GitHub repository](https://github.com/reportportal/agent-Python-RobotFramework). |
| 49 | + |
| 50 | +2. Clone your fork locally using [git](https://git-scm.com/) and create a branch: |
| 51 | + |
| 52 | + ```sh |
| 53 | + $ git clone [email protected]:YOUR_GITHUB_USERNAME/agent-Python-RobotFramework.git |
| 54 | + $ cd agent-Python-RobotFramework |
| 55 | + # now, create your own branch off the "master": |
| 56 | + $ git checkout -b your-bugfix-branch-name |
| 57 | + ``` |
| 58 | + |
| 59 | + If you need some help with Git, follow this quick start guide: https://git.wiki.kernel.org/index.php/QuickStart |
| 60 | + |
| 61 | +3. Install [pre-commit](https://pre-commit.com) and its hook on the agent-Python-RobotFramework repo: |
| 62 | + |
| 63 | + **Note: pre-commit must be installed as admin, as it will not function otherwise**: |
| 64 | + |
| 65 | + ```sh |
| 66 | + $ pip install --user pre-commit |
| 67 | + $ pre-commit install |
| 68 | + ``` |
| 69 | + |
| 70 | + Afterward `pre-commit` will run whenever you commit. |
| 71 | + |
| 72 | + [https://pre-commit.com](https://pre-commit.com) is a framework for managing and maintaining multi-language pre-commit hooks to ensure code-style and code formatting is consistent. |
| 73 | + |
| 74 | +4. Install tox |
| 75 | + |
| 76 | + Tox is used to run all the tests and will automatically set up virtualenvs to run the tests in. (will implicitly use http://www.virtualenv.org/en/latest/): |
| 77 | + |
| 78 | + ```sh |
| 79 | + $ pip install tox |
| 80 | + ``` |
| 81 | + |
| 82 | +5. Run all the tests |
| 83 | + |
| 84 | + You need to have Python 3.10 available in your system. Now running tests is as simple as issuing this command: |
| 85 | + |
| 86 | + ```sh |
| 87 | + $ tox -e pep,py310 |
| 88 | + ``` |
| 89 | + |
| 90 | + This command will run tests via the "tox" tool against Python 3.10 and also perform code style checks. |
| 91 | + |
| 92 | +6. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 recommendations. |
| 93 | + |
| 94 | + You can pass different options to `tox`. For example, to run tests on Python 3.10 and pass options to pytest (e.g. enter pdb on failure) to pytest you can do: |
| 95 | + |
| 96 | + ```sh |
| 97 | + $ tox -e py310 -- --pdb |
| 98 | + ``` |
| 99 | + |
| 100 | + Or to only run tests in a particular test module on Python 3.10: |
| 101 | + |
| 102 | + ```sh |
| 103 | + $ tox -e py310 -- tests/test_service.py |
| 104 | + ``` |
| 105 | + |
| 106 | + When committing, `pre-commit` will re-format the files if necessary. |
| 107 | + |
| 108 | +7. If instead of using `tox` you prefer to run the tests directly, then we suggest to create a virtual environment and use an editable installation with the `testing` extra: |
| 109 | + |
| 110 | + ```sh |
| 111 | + $ python3 -m venv .venv |
| 112 | + $ source .venv/bin/activate # Linux |
| 113 | + $ .venv/Scripts/activate.bat # Windows |
| 114 | + $ pip install -e ".[testing]" |
| 115 | + ``` |
| 116 | + |
| 117 | + Afterwards, you can edit the files and run pytest normally: |
| 118 | + |
| 119 | + ```sh |
| 120 | + $ pytest tests/test_service.py |
| 121 | + ``` |
| 122 | + |
| 123 | +8. Commit and push once your tests pass and you are happy with your change(s): |
| 124 | + |
| 125 | + ```sh |
| 126 | + $ git commit -m "<commit message>" |
| 127 | + $ git push -u |
| 128 | + ``` |
| 129 | + |
| 130 | +9. Finally, submit a pull request through the GitHub website using this data: |
| 131 | + |
| 132 | + head-fork: YOUR_GITHUB_USERNAME/agent-Python-RobotFramework |
| 133 | + compare: your-branch-name |
| 134 | + |
| 135 | + base-fork: reportportal/agent-Python-RobotFramework |
| 136 | + base: master |
0 commit comments