RedHatQE / pylero

Python wrapper for the Polarion WSDL API
https://redhatqe.github.io/pylero/
MIT License
38 stars 25 forks source link

Fix/add test record by object #177

Closed AlthausKonstantin closed 6 months ago

AlthausKonstantin commented 7 months ago

Hi there!

This PR is addresses https://github.com/RedHatQE/pylero/issues/175.

I refactored the functions create_incident_report and generate_description to methods of the class TestRun. In those two methods, I circumnavigate the usage of TestCase by using the project's predefined test case work item (member of project.get_tests_configuration()). Should also this work item type not exist, I use the base class _WorkItem.

I have tested this exploratively on my side, but I could not figure out how to run the unit tests. Can I do that at all?

leelavg commented 6 months ago

but I could not figure out how to run the unit tests

  • see if this helps, you just create a dummy project and set that in your config and tests will be run against that project, there is no regression w/ this PR.
  • I use the local commit mentioned in below listing just to make install pylero as editable (helps for debugging w/ breakpoint) and run tests.
    
    # gpr 117
    From github.com:RedHatQE/pylero
  • [new ref] refs/pull/117/head -> pr117 Switched to branch 'pr117'

g cherry-pick ad1561f

Auto-merging setup.py [pr117 bb6554d] editable temp commit Date: Wed Jan 25 08:21:30 2023 +0530 1 file changed, 2 insertions(+), 1 deletion(-)

g show

commit bb6554dd7786446a12ac62e28dd1194f76f829b5 (HEAD -> pr117) Author: Leela Venkaiah G lgangava@redhat.com Date: Wed Jan 25 08:21:30 2023 +0530

editable temp commit

diff --git a/setup.py b/setup.py index b3f50e8..c7109a3 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,8 @@ if name == "main": author_email="dno-tools@redhat.com", license="MIT", package_dir={

pip install -e .

Obtaining file:///root/toolbox/pylero Installing build dependencies ... done Checking if build backend supports build_editable ... done Getting requirements to build editable ... done Preparing editable metadata (pyproject.toml) ... done Requirement already satisfied: click in /root/toolbox/venv/pylero/lib/python3.12/site-packages (from pylero==0.0.4) (8.1.7) Requirement already satisfied: suds in /root/toolbox/venv/pylero/lib/python3.12/site-packages (from pylero==0.0.4) (1.1.2) Building wheels for collected packages: pylero Building editable for pylero (pyproject.toml) ... done Created wheel for pylero: filename=pylero-0.0.4-0.editable-py3-none-any.whl size=9036 sha256=9ef54ab7abb89f41ec9accd68a07842f6310d3dfdffe0cfc1549fc4f45b43410 Stored in directory: /tmp/pip-ephem-wheel-cache-3sf9pgxw/wheels/92/72/83/a4d9f0ebfaf6b6fd6d5d457218f1aba28e9ef2e2a6c1bd9e31 Successfully built pylero Installing collected packages: pylero Attempting uninstall: pylero Found existing installation: pylero 0.0.9 Uninstalling pylero-0.0.9: Successfully uninstalled pylero-0.0.9 Successfully installed pylero-0.0.4

[notice] A new release of pip is available: 23.2.1 -> 24.0 [notice] To update, run: pip install --upgrade pip

cp .pylero ~/.pylero

cd src/unit_tests/

python -m unittest

..............

Ran 14 tests in 103.358s

OK

leelavg commented 6 months ago

/hold merge for rework on reviewable diff

AlthausKonstantin commented 6 months ago

I cleaned up my history :)

waynesun09 commented 6 months ago

Great work, I've tested it and it pass my local test without regression.

For test local, after create a dummy project and prepared a .pylero config with it and user token, the src/unit_tests/attribute_test.py have two hard code users USER and ALT_USER might need be created on your instance.

Thanks for working on this.