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

Add project_id option to query method of _WorkItem #12

Closed
wants to merge 232 commits into from
Closed

Add project_id option to query method of _WorkItem #12

wants to merge 232 commits into from

Conversation

leelavg
Copy link
Collaborator

@leelavg leelavg commented Mar 18, 2021

  • Provides ability to call query on individual WI_TYPES
    with default project

Fixes: #11

Vaclav Kadlcik and others added 30 commits November 26, 2014 09:57
Definitely ugly, this usage calls for custom fields.
I'm using what available just now and want to prototype
fast.
Each Polarion's Test Run has a wiki page which is a typed
text so we can use it to implement SimpleTestRun.
(Originally I proposed Test Run's description for that
- that would be even worse...) Hence SimpleTestRun and
SimpleTestPlan are mapped nearly the same way to their
Polarion counterparts.

Anyway, we are talking about a temporary implementation.
Both SimpleTestRun and SimpleTestPlan should be mapped
more naturally and safely, probably using new custom
fields for Test Runs and Documents.
See 6abb976. I should
solve it in a robus way, I only...
WARNING: This is a hackish implementation of a provisional
         design.

Teach SimpleTestPlan to refer another ("parent") test
plan. Similarly, teach SimpleTestRun to refer a test
plan.

For background, read interface.py.
Teach SimpleTestRun manage test cases using their URIs
Seems like all the basic building pieces drafted...
Time to go one level up to "business logic" API?
Improve test cases' CRUD: implement tags, the automation
flag, and the test script URL.
Reimplement how SimpleTestRun access the referred Test Plan
and own Test Records: Move from special methods to plain
attributes which get store or retrieved on SimpleTestRun's
CRUD operations.
Since most of the code is CamelCasing...
Move rest of names_with_underlines to CamelCasing.
On Session, provide public methods to create a test case of any type.
On Session, provide a public methods to create a test plan
(SimpleTestPlan).

I'm feeling tired. This one took too much time to debug&fix
in spite no really new code here :-(
On Session, provide a public method to create a test run
(SimpleTestRun).

The really new code here is a "generator" of test runs' names:
1. Create a prefix
   1. use a name given by the user, if given, otherwise:
   2. use a name of the test plan, if any, otherwise:
   3. use the login name of the user
2. Append a "counter" value
My month-long vacation will start in a hour or so (hurray!).
Infortunately, not much to celebrate here: The internals
done-but-so-so, the public API partly, however no CLI. I'm
trying to log the the bigger picture. Just in case...
I'm reading this after a month-long pause and it's all Greek to me.
Anyway, fix the Greek...
Sim Zacks and others added 19 commits July 27, 2020 08:25
[LibFix] Replace `readline` with `gnureadline`

See merge request ccit/pylarion!5
Change-Id: Ia8dfa47ff0e1c82c9eb834b6fd002a2b6a72e4ad
In the dynamically created workitems, the class is called IncidentReport

Change-Id: Ia35d67e88c3fb5769a61221110dc25febe4416cd
Change incident in tests

See merge request ccit/pylarion!14
- Currently work in-progress
- Based on discussion before finalizing commit will be amended
and reposted for merge
Renamed all files with the word pylarion to pylero

Change-Id: I8ff1af9aa03be4335bf1d7787ad935e194201dce
Changed all instances of pylarion to pylero

Change-Id: I2ac745f427f8630cd03c87186b1e40b0d4763517
Change pylarion to pylero

See merge request ccit/pylarion!16
- Change README from txt to markdown
- Fix alignment of the doc
- Fix examples section
[DocFix] Change README.txt to README.md

See merge request ccit/pylarion!17
_WorkItems have priority as a PriorityOptionId. This is not a real enum
as it accepts any numeric value within a string (e.g. "50.0")

Change-Id: I9ca4680326e9e5efed651820082a77d59db59f28
fixed the priorityoptionid object

See merge request ccit/pylarion!18
Remove Red Hat specific workflows, manage readline dependency

See merge request ccit/pylarion!20
Replace internal links with generic URLs

See merge request ccit/pylarion!21
Prioritize vars from environ and then config file, doc cleanup

See merge request ccit/pylarion!22
@leelavg leelavg requested a review from simzacks March 18, 2021 04:45
- Provides ability to call query on individual WI_TYPES
with default project

Fixes: #11

Signed-off-by: Leela Venkaiah G <[email protected]>
@leelavg
Copy link
Collaborator Author

leelavg commented Mar 18, 2021

  • Running autopep8 on whole project is cumbersome, let's use flake8 and autopep8 before raising a PR
# flake8 src/pylero/work_item.py
src/pylero/work_item.py:9:1: F401 'json' imported but unused
src/pylero/work_item.py:408:44: E225 missing whitespace around operator
src/pylero/work_item.py:527:40: E127 continuation line over-indented for visual indent
src/pylero/work_item.py:548:40: E127 continuation line over-indented for visual indent
src/pylero/work_item.py:571:40: E127 continuation line over-indented for visual indent
src/pylero/work_item.py:1387:40: E127 continuation line over-indented for visual indent
src/pylero/work_item.py:1394:40: E127 continuation line over-indented for visual indent
src/pylero/work_item.py:1415:17: E117 over-indented (comment)
src/pylero/work_item.py:1416:17: E117 over-indented (comment)
src/pylero/work_item.py:1417:17: E117 over-indented
src/pylero/work_item.py:1521:40: E127 continuation line over-indented for visual indent
src/pylero/work_item.py:1539:1: E305 expected 2 blank lines after class or function definition, found 1

# Not aggressive just confirming to PEP 8
# autopep8 -i src/pylero/work_item.py

# flake8 src/pylero/work_item.py

@simzacks
Copy link
Contributor

I'm unsure if we want to enforce a project_id on all queries, or make it optional. The question is would any of our users ever want to query the entire system, instead of just their project.

@simzacks
Copy link
Contributor

Note that this should bprobably be a decision across the entire library and not just in this one function

@leelavg
Copy link
Collaborator Author

leelavg commented Mar 19, 2021

@simzacks ack,

taking a step back and reflecting upon the issue:

  • With WI_TYPE.query(query): Even if query argument doesn't consist project_id we are adding default_project, as WI_TYPE is created on fly from _SpecificWorkItem

  • With WI_TYPE.get_query_result_count(query): We are directly calling method on tracker_client without modifying query argument and so the difference in result

Based on above, we can either just document the behaviour or enforce get_query_result_count to be an internal only method.

What's your view?

@simzacks
Copy link
Contributor

simzacks commented Apr 5, 2021

I think the best way around this is to somehow both enable the users to use a default and at the same time enable them to somehow indicate that they want to query the whole system. Maybe add a BasePolarion attribute query_entire_system, which will override the default project.

@leelavg leelavg marked this pull request as draft September 29, 2021 12:49
@waynesun09 waynesun09 closed this Jan 13, 2022
@leelavg leelavg deleted the add-default-project branch January 14, 2022 02:34
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.

TestCase.get_query_result_count doesn't return the same as TestCase.query