python-utility-scripts 1.0.14__tar.gz → 1.0.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_utility_scripts-1.0.16/.gitignore +161 -0
- python_utility_scripts-1.0.16/PKG-INFO +78 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/README.md +21 -21
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/polarion/polarion_set_automated.py +28 -6
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/polarion/polarion_utils.py +37 -8
- python_utility_scripts-1.0.16/pyproject.toml +84 -0
- python_utility_scripts-1.0.14/PKG-INFO +0 -85
- python_utility_scripts-1.0.14/pyproject.toml +0 -84
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/LICENSE +0 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/__init__.py +0 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/jira_utils/README.md +0 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/jira_utils/__init__.py +0 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/jira_utils/jira_information.py +0 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/polarion/README.md +0 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/polarion/__init__.py +0 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/polarion/polarion_verify_tc_requirements.py +0 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/unused_code/README.md +0 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/unused_code/__init__.py +0 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/unused_code/unused_code.py +0 -0
- {python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/utils.py +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
.tests_coverage/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# poetry
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
103
|
+
#poetry.lock
|
|
104
|
+
|
|
105
|
+
# pdm
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
107
|
+
#pdm.lock
|
|
108
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
109
|
+
# in version control.
|
|
110
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
111
|
+
.pdm.toml
|
|
112
|
+
|
|
113
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
114
|
+
__pypackages__/
|
|
115
|
+
|
|
116
|
+
# Celery stuff
|
|
117
|
+
celerybeat-schedule
|
|
118
|
+
celerybeat.pid
|
|
119
|
+
|
|
120
|
+
# SageMath parsed files
|
|
121
|
+
*.sage.py
|
|
122
|
+
|
|
123
|
+
# Environments
|
|
124
|
+
.env
|
|
125
|
+
.venv
|
|
126
|
+
env/
|
|
127
|
+
venv/
|
|
128
|
+
ENV/
|
|
129
|
+
env.bak/
|
|
130
|
+
venv.bak/
|
|
131
|
+
|
|
132
|
+
# Spyder project settings
|
|
133
|
+
.spyderproject
|
|
134
|
+
.spyproject
|
|
135
|
+
|
|
136
|
+
# Rope project settings
|
|
137
|
+
.ropeproject
|
|
138
|
+
|
|
139
|
+
# mkdocs documentation
|
|
140
|
+
/site
|
|
141
|
+
|
|
142
|
+
# mypy
|
|
143
|
+
.mypy_cache/
|
|
144
|
+
.dmypy.json
|
|
145
|
+
dmypy.json
|
|
146
|
+
|
|
147
|
+
# Pyre type checker
|
|
148
|
+
.pyre/
|
|
149
|
+
|
|
150
|
+
# pytype static type analyzer
|
|
151
|
+
.pytype/
|
|
152
|
+
|
|
153
|
+
# Cython debug symbols
|
|
154
|
+
cython_debug/
|
|
155
|
+
|
|
156
|
+
# PyCharm
|
|
157
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
158
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
159
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
160
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
161
|
+
.idea/
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python-utility-scripts
|
|
3
|
+
Version: 1.0.16
|
|
4
|
+
Summary: Python utility scripts
|
|
5
|
+
Project-URL: Homepage, https://github.com/RedHatQE/python-utility-scripts
|
|
6
|
+
Project-URL: Repository, https://github.com/RedHatQE/python-utility-scripts
|
|
7
|
+
Project-URL: Documentation, https://github.com/RedHatQE/python-utility-scripts/blob/main/README.md
|
|
8
|
+
Author-email: dbasunag <dbasunag@redhat.com>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: ~=3.9
|
|
14
|
+
Requires-Dist: jira<4,>=3.6.0
|
|
15
|
+
Requires-Dist: pyhelper-utils<2,>=1.0.1
|
|
16
|
+
Requires-Dist: pylero<0.2,>=0.1.0
|
|
17
|
+
Requires-Dist: pytest-mock<4,>=3.14.0
|
|
18
|
+
Requires-Dist: python-simple-logger<3,>=2.0.0
|
|
19
|
+
Requires-Dist: pyyaml<7,>=6.0.1
|
|
20
|
+
Requires-Dist: tenacity<10,>=9.0.0
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# python-utility-scripts
|
|
24
|
+
|
|
25
|
+
Repository for various python utility scripts
|
|
26
|
+
|
|
27
|
+
- [pyutils-unusedcode](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/unused_code/README.md)
|
|
28
|
+
- [pyutils-polarion-verify-tc-requirements](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/polarion/README.md)
|
|
29
|
+
- [pyutils-jira](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/jira_utils/README.md)
|
|
30
|
+
- [pyutils-polarion-set-automated](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/polarion/README.md)
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
using [uv](https://github.com/astral-sh/uv)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uv tool install python-utility-scripts
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Local run
|
|
41
|
+
|
|
42
|
+
- Clone the [repository](https://github.com/RedHatQE/python-utility-scripts.git)
|
|
43
|
+
|
|
44
|
+
## Config file
|
|
45
|
+
|
|
46
|
+
A config yaml file for various utilities of this repository should be added to
|
|
47
|
+
`~/.config/python-utility-scripts/config.yaml`. Script specific config section details can be found in associated script README.md
|
|
48
|
+
|
|
49
|
+
## Release new version
|
|
50
|
+
|
|
51
|
+
### requirements
|
|
52
|
+
|
|
53
|
+
- Export GitHub token
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
export GITHUB_TOKEN=<your_github_token>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- [release-it](https://github.com/release-it/release-it)
|
|
60
|
+
|
|
61
|
+
- Run the following once (execute outside repository dir for example `~/`):
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
sudo npm install --global release-it
|
|
65
|
+
npm install --save-dev @j-ulrich/release-it-regex-bumper
|
|
66
|
+
rm -f package.json package-lock.json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### usage
|
|
70
|
+
|
|
71
|
+
- Create a release, run from the relevant branch.
|
|
72
|
+
To create a new release, run:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git checkout main
|
|
76
|
+
git pull
|
|
77
|
+
release-it # Follow the instructions
|
|
78
|
+
```
|
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
# python-utility-scripts
|
|
2
|
+
|
|
2
3
|
Repository for various python utility scripts
|
|
3
|
-
* [pyutils-unusedcode](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/unused_code/README.md)
|
|
4
|
-
* [pyutils-polarion-verify-tc-requirements](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/polarion/README.md)
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
- [pyutils-unusedcode](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/unused_code/README.md)
|
|
6
|
+
- [pyutils-polarion-verify-tc-requirements](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/polarion/README.md)
|
|
7
|
+
- [pyutils-jira](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/jira_utils/README.md)
|
|
8
|
+
- [pyutils-polarion-set-automated](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/polarion/README.md)
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
pip3 install python-utility-scripts --user
|
|
10
|
-
```
|
|
10
|
+
## Installation
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
* Clone the [repository](https://github.com/RedHatQE/python-utility-scripts.git)
|
|
12
|
+
using [uv](https://github.com/astral-sh/uv)
|
|
14
13
|
|
|
15
14
|
```bash
|
|
16
|
-
|
|
15
|
+
uv tool install python-utility-scripts
|
|
17
16
|
```
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
## Local run
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
poetry install
|
|
23
|
-
```
|
|
20
|
+
- Clone the [repository](https://github.com/RedHatQE/python-utility-scripts.git)
|
|
24
21
|
|
|
25
22
|
## Config file
|
|
23
|
+
|
|
26
24
|
A config yaml file for various utilities of this repository should be added to
|
|
27
25
|
`~/.config/python-utility-scripts/config.yaml`. Script specific config section details can be found in associated script README.md
|
|
28
26
|
|
|
29
|
-
|
|
30
27
|
## Release new version
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
|
|
29
|
+
### requirements
|
|
30
|
+
|
|
31
|
+
- Export GitHub token
|
|
33
32
|
|
|
34
33
|
```bash
|
|
35
34
|
export GITHUB_TOKEN=<your_github_token>
|
|
36
35
|
```
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
- [release-it](https://github.com/release-it/release-it)
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
- Run the following once (execute outside repository dir for example `~/`):
|
|
41
40
|
|
|
42
41
|
```bash
|
|
43
42
|
sudo npm install --global release-it
|
|
@@ -45,9 +44,10 @@ npm install --save-dev @j-ulrich/release-it-regex-bumper
|
|
|
45
44
|
rm -f package.json package-lock.json
|
|
46
45
|
```
|
|
47
46
|
|
|
48
|
-
### usage
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
### usage
|
|
48
|
+
|
|
49
|
+
- Create a release, run from the relevant branch.
|
|
50
|
+
To create a new release, run:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
53
|
git checkout main
|
|
@@ -20,12 +20,22 @@ def approve_tests(polarion_project_id: str, added_ids: list[str]) -> dict[str, l
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def remove_approved_tests(
|
|
23
|
-
polarion_project_id: str,
|
|
23
|
+
polarion_project_id: str,
|
|
24
|
+
branch: str | None = None,
|
|
25
|
+
previous_commit: str | None = None,
|
|
26
|
+
current_commit: str | None = None,
|
|
27
|
+
added_ids: list[str] | None = None,
|
|
24
28
|
) -> dict[str, list[str]]:
|
|
25
29
|
removed_polarions = {}
|
|
26
30
|
added_ids = added_ids or []
|
|
27
31
|
if removed_ids := set(
|
|
28
|
-
find_polarion_ids(
|
|
32
|
+
find_polarion_ids(
|
|
33
|
+
polarion_project_id=polarion_project_id,
|
|
34
|
+
string_to_match="removed",
|
|
35
|
+
branch=branch,
|
|
36
|
+
previous_commit=previous_commit,
|
|
37
|
+
current_commit=current_commit,
|
|
38
|
+
)
|
|
29
39
|
) - set(added_ids):
|
|
30
40
|
LOGGER.info(f"Following polarion ids were removed: {removed_ids}")
|
|
31
41
|
removed_polarions = update_polarion_ids(
|
|
@@ -43,9 +53,12 @@ def remove_approved_tests(
|
|
|
43
53
|
default=os.path.expanduser("~/.config/python-utility-scripts/config.yaml"),
|
|
44
54
|
)
|
|
45
55
|
@click.option("--project-id", "-p", help="Provide the polarion project id")
|
|
46
|
-
@click.option("--
|
|
56
|
+
@click.option("--previous-commit", "-p", help="Provide previous-commit to compare against", required=True)
|
|
57
|
+
@click.option("--current-commit", "-c", help="Provide current-commit to compare with", required=True)
|
|
47
58
|
@click.option("--verbose", default=False, is_flag=True)
|
|
48
|
-
def polarion_approve_automate(
|
|
59
|
+
def polarion_approve_automate(
|
|
60
|
+
config_file_path: str, project_id: str, previous_commit: str, current_commit: str, verbose: bool
|
|
61
|
+
) -> None:
|
|
49
62
|
if verbose:
|
|
50
63
|
LOGGER.setLevel(logging.DEBUG)
|
|
51
64
|
# since the utilities are in apps.polarion.polarion_utils, we need to change log level
|
|
@@ -56,12 +69,21 @@ def polarion_approve_automate(config_file_path: str, project_id: str, branch: st
|
|
|
56
69
|
config_file_path=config_file_path, util_name="pyutils-polarion-set-automated"
|
|
57
70
|
)
|
|
58
71
|
added_polarions = {}
|
|
59
|
-
if added_ids := find_polarion_ids(
|
|
72
|
+
if added_ids := find_polarion_ids(
|
|
73
|
+
polarion_project_id=polarion_project_id,
|
|
74
|
+
string_to_match="added",
|
|
75
|
+
branch=None,
|
|
76
|
+
previous_commit=previous_commit,
|
|
77
|
+
current_commit=current_commit,
|
|
78
|
+
):
|
|
60
79
|
added_polarions = approve_tests(polarion_project_id=polarion_project_id, added_ids=added_ids)
|
|
61
80
|
LOGGER.debug(f"Following polarion ids were marked automated and approved: {added_polarions.get('updated')}")
|
|
62
81
|
|
|
63
82
|
removed_polarions = remove_approved_tests(
|
|
64
|
-
polarion_project_id=polarion_project_id,
|
|
83
|
+
polarion_project_id=polarion_project_id,
|
|
84
|
+
added_ids=added_ids,
|
|
85
|
+
previous_commit=previous_commit,
|
|
86
|
+
current_commit=current_commit,
|
|
65
87
|
)
|
|
66
88
|
if removed_polarions.get("failed") or added_polarions.get("failed"):
|
|
67
89
|
error = "Following polarion ids updates failed."
|
{python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/polarion/polarion_utils.py
RENAMED
|
@@ -15,14 +15,28 @@ NOT_AUTOMATED = "notautomated"
|
|
|
15
15
|
APPROVED = "approved"
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
def git_diff(branch: str) -> str:
|
|
19
|
-
|
|
18
|
+
def git_diff(branch: str | None = None, current_commit: str | None = None, previous_commit: str | None = None) -> str:
|
|
19
|
+
if branch and (previous_commit or current_commit):
|
|
20
|
+
LOGGER.error("Branch and Previous or current commit are mutually exclusive command line options.")
|
|
21
|
+
sys.exit(1)
|
|
22
|
+
|
|
23
|
+
# Sanitize inputs to prevent command injection
|
|
24
|
+
if branch:
|
|
25
|
+
sanitized_branch = shlex.quote(branch)
|
|
26
|
+
diff_command = f"git diff {sanitized_branch} HEAD"
|
|
27
|
+
else:
|
|
28
|
+
sanitized_previous = shlex.quote(previous_commit) if previous_commit else ""
|
|
29
|
+
sanitized_current = shlex.quote(current_commit) if current_commit else ""
|
|
30
|
+
diff_command = f"git diff {sanitized_previous} {sanitized_current}"
|
|
31
|
+
data = subprocess.check_output(shlex.split(diff_command))
|
|
20
32
|
return data.decode()
|
|
21
33
|
|
|
22
34
|
|
|
23
|
-
def git_diff_lines(
|
|
35
|
+
def git_diff_lines(
|
|
36
|
+
branch: str | None = None, previous_commit: str | None = None, current_commit: str | None = None
|
|
37
|
+
) -> dict[str, list[str]]:
|
|
24
38
|
diff: dict[str, list[str]] = {}
|
|
25
|
-
for line in git_diff(branch=branch).splitlines():
|
|
39
|
+
for line in git_diff(branch=branch, current_commit=current_commit, previous_commit=previous_commit).splitlines():
|
|
26
40
|
LOGGER.debug(line)
|
|
27
41
|
if line.startswith("+"):
|
|
28
42
|
diff.setdefault("added", []).append(line)
|
|
@@ -43,7 +57,12 @@ def validate_polarion_requirements(
|
|
|
43
57
|
for _id in polarion_test_ids:
|
|
44
58
|
has_req = False
|
|
45
59
|
LOGGER.debug(f"Checking if {_id} verifies any requirement")
|
|
46
|
-
|
|
60
|
+
try:
|
|
61
|
+
tc = TestCase(project_id=polarion_project_id, work_item_id=_id)
|
|
62
|
+
except PyleroLibException:
|
|
63
|
+
LOGGER.error(f"{_id}: Test case not found.")
|
|
64
|
+
tests_with_missing_requirements.append(_id)
|
|
65
|
+
continue
|
|
47
66
|
for link in tc.linked_work_items:
|
|
48
67
|
try:
|
|
49
68
|
Requirement(project_id=polarion_project_id, work_item_id=link.work_item_id)
|
|
@@ -53,15 +72,25 @@ def validate_polarion_requirements(
|
|
|
53
72
|
continue
|
|
54
73
|
|
|
55
74
|
if not has_req:
|
|
56
|
-
LOGGER.error(f"{_id}:
|
|
75
|
+
LOGGER.error(f"{_id}: does not have associated requirement.")
|
|
57
76
|
tests_with_missing_requirements.append(_id)
|
|
58
77
|
return tests_with_missing_requirements
|
|
59
78
|
|
|
60
79
|
|
|
61
|
-
def find_polarion_ids(
|
|
80
|
+
def find_polarion_ids(
|
|
81
|
+
polarion_project_id: str,
|
|
82
|
+
string_to_match: str,
|
|
83
|
+
branch: str | None = None,
|
|
84
|
+
previous_commit: str | None = None,
|
|
85
|
+
current_commit: str | None = None,
|
|
86
|
+
) -> list[str]:
|
|
62
87
|
return re.findall(
|
|
63
88
|
rf"pytest.mark.polarion.*({polarion_project_id}-[0-9]+)",
|
|
64
|
-
"\n".join(
|
|
89
|
+
"\n".join(
|
|
90
|
+
git_diff_lines(branch=branch, previous_commit=previous_commit, current_commit=current_commit).get(
|
|
91
|
+
string_to_match, []
|
|
92
|
+
)
|
|
93
|
+
),
|
|
65
94
|
re.MULTILINE | re.IGNORECASE,
|
|
66
95
|
)
|
|
67
96
|
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "python-utility-scripts"
|
|
3
|
+
version = "1.0.16"
|
|
4
|
+
description = "Python utility scripts"
|
|
5
|
+
requires-python = "~=3.9"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Programming Language :: Python :: 3",
|
|
10
|
+
"Operating System :: OS Independent"
|
|
11
|
+
]
|
|
12
|
+
dependencies = [
|
|
13
|
+
"pylero>=0.1.0,<0.2",
|
|
14
|
+
"pytest-mock>=3.14.0,<4",
|
|
15
|
+
"pyyaml>=6.0.1,<7",
|
|
16
|
+
"jira>=3.6.0,<4",
|
|
17
|
+
"tenacity>=9.0.0,<10",
|
|
18
|
+
"python-simple-logger>=2.0.0,<3",
|
|
19
|
+
"pyhelper-utils>=1.0.1,<2"
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[[project.authors]]
|
|
23
|
+
name = "dbasunag"
|
|
24
|
+
email = "dbasunag@redhat.com"
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/RedHatQE/python-utility-scripts"
|
|
28
|
+
Repository = "https://github.com/RedHatQE/python-utility-scripts"
|
|
29
|
+
Documentation = "https://github.com/RedHatQE/python-utility-scripts/blob/main/README.md"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
pyutils-unusedcode = "apps.unused_code.unused_code:get_unused_functions"
|
|
33
|
+
pyutils-polarion-verify-tc-requirements = "apps.polarion.polarion_verify_tc_requirements:has_verify"
|
|
34
|
+
pyutils-polarion-set-automated = "apps.polarion.polarion_set_automated:polarion_approve_automate"
|
|
35
|
+
pyutils-jira = "apps.jira_utils.jira_information:get_jira_mismatch"
|
|
36
|
+
|
|
37
|
+
[tool.coverage.run]
|
|
38
|
+
omit = [ "tests/*" ]
|
|
39
|
+
|
|
40
|
+
[tool.coverage.report]
|
|
41
|
+
fail_under = 65
|
|
42
|
+
skip_empty = true
|
|
43
|
+
|
|
44
|
+
[tool.coverage.html]
|
|
45
|
+
directory = ".tests_coverage"
|
|
46
|
+
show_contexts = true
|
|
47
|
+
|
|
48
|
+
[tool.uv]
|
|
49
|
+
default-groups = [ "dev", "test" ]
|
|
50
|
+
|
|
51
|
+
[tool.hatch.build.targets.sdist]
|
|
52
|
+
include = [ "apps" ]
|
|
53
|
+
|
|
54
|
+
[tool.hatch.build.targets.wheel]
|
|
55
|
+
include = [ "apps" ]
|
|
56
|
+
|
|
57
|
+
[tool.mypy]
|
|
58
|
+
show_error_codes = true
|
|
59
|
+
warn_unused_ignores = true
|
|
60
|
+
check_untyped_defs = true
|
|
61
|
+
disallow_any_generics = false
|
|
62
|
+
disallow_incomplete_defs = true
|
|
63
|
+
disallow_untyped_defs = true
|
|
64
|
+
no_implicit_optional = true
|
|
65
|
+
|
|
66
|
+
[tool.ruff]
|
|
67
|
+
preview = true
|
|
68
|
+
line-length = 120
|
|
69
|
+
fix = true
|
|
70
|
+
output-format = "grouped"
|
|
71
|
+
|
|
72
|
+
[tool.ruff.lint]
|
|
73
|
+
extend-select = [ "I" ]
|
|
74
|
+
|
|
75
|
+
[tool.ruff.format]
|
|
76
|
+
exclude = [ ".git", ".venv", ".mypy_cache", ".tox", "__pycache__" ]
|
|
77
|
+
|
|
78
|
+
[dependency-groups]
|
|
79
|
+
dev = [ "ipdb>=0.13.13,<0.14", "ipython" ]
|
|
80
|
+
test = [ "pytest>=8.0.0,<9", "pytest-cov>=6.0.0,<7" ]
|
|
81
|
+
|
|
82
|
+
[build-system]
|
|
83
|
+
requires = [ "hatchling" ]
|
|
84
|
+
build-backend = "hatchling.build"
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: python-utility-scripts
|
|
3
|
-
Version: 1.0.14
|
|
4
|
-
Summary: Python utility scripts
|
|
5
|
-
License: Apache-2.0
|
|
6
|
-
Author: dbasunag
|
|
7
|
-
Author-email: dbasunag@redhat.com
|
|
8
|
-
Requires-Python: >=3.9,<4.0
|
|
9
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
-
Requires-Dist: jira (>=3.6.0,<4.0.0)
|
|
18
|
-
Requires-Dist: pyhelper-utils (>=1.0.1,<2.0.0)
|
|
19
|
-
Requires-Dist: pylero (>=0.1.0,<0.2.0)
|
|
20
|
-
Requires-Dist: pytest-mock (>=3.14.0,<4.0.0)
|
|
21
|
-
Requires-Dist: python-simple-logger (>=2.0.0,<3.0.0)
|
|
22
|
-
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
23
|
-
Requires-Dist: tenacity (>=9.0.0,<10.0.0)
|
|
24
|
-
Project-URL: Documentation, https://github.com/RedHatQE/python-utility-scripts/blob/main/README.md
|
|
25
|
-
Project-URL: Homepage, https://github.com/RedHatQE/python-utility-scripts
|
|
26
|
-
Project-URL: Repository, https://github.com/RedHatQE/python-utility-scripts
|
|
27
|
-
Description-Content-Type: text/markdown
|
|
28
|
-
|
|
29
|
-
# python-utility-scripts
|
|
30
|
-
Repository for various python utility scripts
|
|
31
|
-
* [pyutils-unusedcode](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/unused_code/README.md)
|
|
32
|
-
* [pyutils-polarion-verify-tc-requirements](https://github.com/RedHatQE/python-utility-scripts/blob/main/apps/polarion/README.md)
|
|
33
|
-
|
|
34
|
-
## Installation
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
pip3 install python-utility-scripts --user
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Local run
|
|
41
|
-
* Clone the [repository](https://github.com/RedHatQE/python-utility-scripts.git)
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
git clone https://github.com/RedHatQE/python-utility-scripts.git
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
* Install [poetry](https://github.com/python-poetry/poetry)
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
poetry install
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Config file
|
|
54
|
-
A config yaml file for various utilities of this repository should be added to
|
|
55
|
-
`~/.config/python-utility-scripts/config.yaml`. Script specific config section details can be found in associated script README.md
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
## Release new version
|
|
59
|
-
### requirements:
|
|
60
|
-
* Export GitHub token
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
export GITHUB_TOKEN=<your_github_token>
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
* [release-it](https://github.com/release-it/release-it)
|
|
67
|
-
|
|
68
|
-
* Run the following once (execute outside repository dir for example `~/`):
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
sudo npm install --global release-it
|
|
72
|
-
npm install --save-dev @j-ulrich/release-it-regex-bumper
|
|
73
|
-
rm -f package.json package-lock.json
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### usage:
|
|
77
|
-
* Create a release, run from the relevant branch.
|
|
78
|
-
To create a new release, run:
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
git checkout main
|
|
82
|
-
git pull
|
|
83
|
-
release-it # Follow the instructions
|
|
84
|
-
```
|
|
85
|
-
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
[tool.coverage.run]
|
|
2
|
-
omit = ["tests/*"]
|
|
3
|
-
|
|
4
|
-
[tool.coverage.report]
|
|
5
|
-
fail_under = 65
|
|
6
|
-
skip_empty = true
|
|
7
|
-
|
|
8
|
-
[tool.coverage.html]
|
|
9
|
-
directory = ".tests_coverage"
|
|
10
|
-
show_contexts = true
|
|
11
|
-
|
|
12
|
-
[tool.mypy]
|
|
13
|
-
show_error_codes = true
|
|
14
|
-
warn_unused_ignores = true
|
|
15
|
-
check_untyped_defs = true
|
|
16
|
-
disallow_any_generics = false
|
|
17
|
-
disallow_incomplete_defs = true
|
|
18
|
-
disallow_untyped_defs = true
|
|
19
|
-
no_implicit_optional = true
|
|
20
|
-
|
|
21
|
-
[tool.ruff]
|
|
22
|
-
preview = true
|
|
23
|
-
line-length = 120
|
|
24
|
-
fix = true
|
|
25
|
-
output-format = "grouped"
|
|
26
|
-
lint.extend-select = ["I"]
|
|
27
|
-
|
|
28
|
-
[tool.ruff.format]
|
|
29
|
-
exclude = [".git", ".venv", ".mypy_cache", ".tox", "__pycache__"]
|
|
30
|
-
|
|
31
|
-
[tool.poetry]
|
|
32
|
-
name = "python-utility-scripts"
|
|
33
|
-
version = "1.0.14"
|
|
34
|
-
description = "Python utility scripts"
|
|
35
|
-
authors = ["dbasunag <dbasunag@redhat.com>"]
|
|
36
|
-
license = "Apache License 2.0"
|
|
37
|
-
readme = "README.md"
|
|
38
|
-
repository = "https://github.com/RedHatQE/python-utility-scripts"
|
|
39
|
-
homepage = "https://github.com/RedHatQE/python-utility-scripts"
|
|
40
|
-
documentation = "https://github.com/RedHatQE/python-utility-scripts/blob/main/README.md"
|
|
41
|
-
classifiers = [
|
|
42
|
-
"Programming Language :: Python :: 3",
|
|
43
|
-
"Operating System :: OS Independent",
|
|
44
|
-
]
|
|
45
|
-
|
|
46
|
-
packages = [{ include = "apps" }]
|
|
47
|
-
|
|
48
|
-
[tool.poetry.scripts]
|
|
49
|
-
pyutils-unusedcode = "apps.unused_code.unused_code:get_unused_functions"
|
|
50
|
-
pyutils-polarion-verify-tc-requirements = "apps.polarion.polarion_verify_tc_requirements:has_verify"
|
|
51
|
-
pyutils-polarion-set-automated = "apps.polarion.polarion_set_automated:polarion_approve_automate"
|
|
52
|
-
pyutils-jira = "apps.jira_utils.jira_information:get_jira_mismatch"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
[tool.poetry.dependencies]
|
|
56
|
-
python = "^3.9"
|
|
57
|
-
pylero = "^0.1.0"
|
|
58
|
-
pytest-mock = "^3.14.0"
|
|
59
|
-
pyyaml = "^6.0.1"
|
|
60
|
-
jira = "^3.6.0"
|
|
61
|
-
tenacity = "^9.0.0"
|
|
62
|
-
python-simple-logger = "^2.0.0"
|
|
63
|
-
pyhelper-utils = "^1.0.1"
|
|
64
|
-
|
|
65
|
-
[tool.poetry.group.dev.dependencies]
|
|
66
|
-
ipdb = "^0.13.13"
|
|
67
|
-
ipython = "*"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
[tool.poetry-dynamic-versioning]
|
|
71
|
-
enable = false
|
|
72
|
-
pattern = "((?P<epoch>\\d+)!)?(?P<base>\\d+(\\.\\d+)*)"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
[tool.poetry.group.test.dependencies]
|
|
76
|
-
pytest = "^8.0.0"
|
|
77
|
-
pytest-cov = "^6.0.0"
|
|
78
|
-
|
|
79
|
-
[tool.poetry-dynamic-versioning.substitution]
|
|
80
|
-
files = ["VERSION"]
|
|
81
|
-
|
|
82
|
-
[build-system]
|
|
83
|
-
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
|
|
84
|
-
build-backend = "poetry_dynamic_versioning.backend"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/jira_utils/jira_information.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/unused_code/__init__.py
RENAMED
|
File without changes
|
{python_utility_scripts-1.0.14 → python_utility_scripts-1.0.16}/apps/unused_code/unused_code.py
RENAMED
|
File without changes
|
|
File without changes
|