Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/add test record by object #177

Merged

Conversation

AlthausKonstantin
Copy link
Contributor

@AlthausKonstantin AlthausKonstantin commented Mar 19, 2024

Hi there!

This PR is addresses #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?

@AlthausKonstantin AlthausKonstantin marked this pull request as ready for review March 19, 2024 12:38
Copy link
Collaborator

@leelavg leelavg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the confusing diff in one of the commits, the change looks good, thanks a lot for working on it! I'll merge after making that specific diff reviewable.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if possible could you pls make this diff reviewable? In this commit c78247e (4th feat: make test_run agnostic of test_work_item_type) the current diff is entire file newly edited which is confusing.

@leelavg
Copy link
Collaborator

leelavg commented Apr 12, 2024

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={
-            PACKAGE_NAME: "src/%s" % PACKAGE_NAME,
+            # PACKAGE_NAME: 'src/%s' % PACKAGE_NAME,
+            "": "src",
         },
         packages=[
             PACKAGE_NAME,
             
# 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
Copy link
Collaborator

leelavg commented Apr 12, 2024

/hold merge for rework on reviewable diff

@AlthausKonstantin
Copy link
Contributor Author

I cleaned up my history :)

@waynesun09
Copy link
Collaborator

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.

@waynesun09 waynesun09 merged commit f1761cc into RedHatQE:main Apr 16, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants