Skip to content

Commit 88d21ad

Browse files
committed
Apply black and isort
1 parent c280471 commit 88d21ad

40 files changed

+963
-1015
lines changed

.flake8

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
[flake8]
2+
ignore = E203, W503, E701
3+
exclude = .git,venv,env
24
max-line-length = 119

.github/workflows/release.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ on:
2020
- '.github/**'
2121
- CHANGELOG.md
2222
- README.md
23-
- CONTRIBUTING.rst
23+
- ../../CONTRIBUTING.md
2424

2525
env:
2626
VERSION_FILE: setup.py
2727
VERSION_EXTRACT_PATTERN: >-
28-
__version__\s*=\s*'([^']+)
28+
__version__\s*=\s*"([^"]+)
2929
VERSION_REPLACE_PATTERN: >-
30-
__version__ = '\1'
30+
__version__ = "\1"
3131
TMP_SUFFIX: _updated
3232
CHANGE_LOG_FILE: CHANGELOG.md
3333

@@ -38,6 +38,13 @@ jobs:
3838
- name: Checkout repository
3939
uses: actions/checkout@v4
4040

41+
- name: Generate versions
42+
uses: HardNorth/github-version-generate@v1
43+
with:
44+
version-source: file
45+
version-file: ${{ env.VERSION_FILE }}
46+
version-file-extraction-pattern: ${{ env.VERSION_EXTRACT_PATTERN }}
47+
4148
- name: Set up Python
4249
uses: actions/setup-python@v5
4350
with:
@@ -55,13 +62,6 @@ jobs:
5562
user: ${{ secrets.PYPI_USERNAME }}
5663
password: ${{ secrets.PYPI_PASSWORD }}
5764

58-
- name: Generate versions
59-
uses: HardNorth/github-version-generate@v1
60-
with:
61-
version-source: file
62-
version-file: ${{ env.VERSION_FILE }}
63-
version-file-extraction-pattern: ${{ env.VERSION_EXTRACT_PATTERN }}
64-
6565
- name: Setup git credentials
6666
uses: oleksiyrudenko/gha-git-credentials@v2-latest
6767
with:
@@ -119,8 +119,8 @@ jobs:
119119
- name: Update version file
120120
id: versionFileUpdate
121121
run: |
122-
export CURRENT_VERSION_VALUE=`echo '${{ env.CURRENT_VERSION }}' | sed -E "s/(.*)/${{ env.VERSION_REPLACE_PATTERN }}/"`
123-
export NEXT_VERSION_VALUE=`echo '${{ env.NEXT_VERSION }}' | sed -E "s/(.*)/${{ env.VERSION_REPLACE_PATTERN }}/"`
122+
export CURRENT_VERSION_VALUE=`echo '${{ env.CURRENT_VERSION }}' | sed -E 's/(.*)/${{ env.VERSION_REPLACE_PATTERN }}/'`
123+
export NEXT_VERSION_VALUE=`echo '${{ env.NEXT_VERSION }}' | sed -E 's/(.*)/${{ env.VERSION_REPLACE_PATTERN }}/'`
124124
sed "s/${CURRENT_VERSION_VALUE}/${NEXT_VERSION_VALUE}/g" ${{ env.VERSION_FILE }} > ${{ env.VERSION_FILE }}${{ env.TMP_SUFFIX }}
125125
rm ${{ env.VERSION_FILE }}
126126
mv ${{ env.VERSION_FILE }}${{ env.TMP_SUFFIX }} ${{ env.VERSION_FILE }}

.pre-commit-config.yaml

+23-29
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v3.4.0
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
66
hooks:
7-
- id: trailing-whitespace
8-
- id: end-of-file-fixer
9-
- id: check-yaml
10-
- id: check-added-large-files
11-
- repo: https://github.com/PyCQA/pydocstyle
12-
rev: 6.0.0
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/PyCQA/pydocstyle
12+
rev: 6.3.0
1313
hooks:
14-
- id: pydocstyle
15-
# Temporary exclude files in which are in charge of offline reporting
14+
- id: pydocstyle
1615
exclude: |
17-
(?x)^(
18-
tests/*|
19-
robotframework_reportportal/result_visitor.py|
20-
robotframework_reportportal/post_report.py|
21-
robotframework_reportportal/time_visitor.py
22-
)
23-
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
24-
rev: v1.0.1
16+
(?x)^(
17+
tests/.*
18+
)
19+
- repo: https://github.com/psf/black
20+
rev: 24.10.0
2521
hooks:
26-
- id: rst-linter
27-
- repo: https://github.com/pycqa/flake8
28-
rev: 5.0.4
22+
- id: black
23+
args: [ 'reportportal_client', 'tests' ]
24+
- repo: https://github.com/pycqa/isort
25+
rev: 5.13.2
2926
hooks:
30-
- id: flake8
31-
# Temporary exclude files in which are in charge of offline reporting
32-
exclude: |
33-
(?x)^(
34-
robotframework_reportportal/result_visitor.py|
35-
robotframework_reportportal/post_report.py|
36-
robotframework_reportportal/time_visitor.py
37-
)$
27+
- id: isort
28+
- repo: https://github.com/pycqa/flake8
29+
rev: 7.1.1
30+
hooks:
31+
- id: flake8

CONTRIBUTING.md

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
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

Comments
 (0)