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

Increase pytest coverage by either adding tests or removing unused code #31

Merged
merged 7 commits into from
Sep 21, 2021
Merged

Conversation

marco-miller
Copy link
Contributor

@marco-miller marco-miller commented Sep 10, 2021

  • Add a completed timegraph tree test in TestTspClient.
  • Remove the unused DataType class with its whole file.
  • Remove the redundant local variable in EntryModel.
  • Move Tree{Model,Item} out of the tsp package, being cli only.
  • Add pragmas where there is no pytest coverage necessary yet.

@marco-miller marco-miller changed the title Coverage TestTspClient: Add complete{d} timegraph tree test; remove resulting duplication Sep 10, 2021
@marco-miller
Copy link
Contributor Author

My latest force-push (diff linked above) here only rebased this PR on #28, still per description at top above.

@marco-miller marco-miller changed the title TestTspClient: Add complete{d} timegraph tree test; remove resulting duplication Increase pytest coverage by either adding tests or removing unused code Sep 14, 2021
@marco-miller marco-miller marked this pull request as draft September 14, 2021 20:00
@marco-miller marco-miller marked this pull request as ready for review September 15, 2021 14:40
@marco-miller
Copy link
Contributor Author

Per this PR description at top, this PR is based on #28, so this specific review starts with e652dbb included (then up).

@marco-miller
Copy link
Contributor Author

My very latest force-push only rebased this PR on current latest #28. So this PR now starts with
ac2fe21 and up (7 commits total, here).

Base this new test on the existing test_fetch_xy. Rename the hereby
reused REQUESTED_TIME constants accordingly; no longer XY-specific.

Don't redundantly assert model_type; test_fetch_timegraph_tree does so
already. Now, adding this test increases test coverage (cf. README) in
these specific ways:

- time_graph_model.py: from 25% to 33%;
- entry_model.py:      from 84% to 88%;
- response.py:         from 86% to 89%.

<=> From 59% to 60% total. More work remains then to cover tsp/ further.

Signed-off-by: Marco Miller <[email protected]>
Remove the duplication introduced by test_fetch_timegraph_tree_complete,
which was based on test_fetch_xy. Add the private __requested_parameters
helper method for this.

Signed-off-by: Marco Miller <[email protected]>
If some data is needed to be transferred between server and clients over
the TSP, then it needs to properly be specified in the TSP, so that
clients and server can support it.

Fixes #35

Signed-off-by: Marco Miller <[email protected]>
Move tree_model.py's whole content (both classes) out of the tsp/
package, as only ./tsp-cli-client uses it. Make the file a sibling of
the latter, as duly expected.

This move also solves the issue of tsp/ pytest coverage previously
reporting that file as not covered at all.

Signed-off-by: Marco Miller <[email protected]>
The pytest(s) coverage and its reporting is not meant to cover all
paths. Add no-cover pragma directives to uncovered paths that may be
safely ignored by pytest reporting. Do so as the scope of these tests is
mainly integration and main coverage of client paths towards the server.

Ignore paths such as negative or corner (thus less likely) cases. Ignore
paths also that are either TODO code or manual cli printouts and cases.

The remaining uncovered lines are backlogged to be covered further, yet
through larger efforts. README has the pytest command showing the
report, which currently shows 80% coverage (round number a coincidence).

Some no-cover pragmas might be removed as some more paths end up being
covered, through potential pytest or code amends.

Signed-off-by: Marco Miller <[email protected]>
@marco-miller
Copy link
Contributor Author

@MatthewKhouzam and @bhufmann, this PR contains only its own diffs now, ready for your review; thanks.

@bhufmann
Copy link
Collaborator

@MatthewKhouzam and @bhufmann, this PR contains only its own diffs now, ready for your review; thanks.

@marco-miller The code looks good to me. I'm ok to remove the parsing and storing of the unspecified parameters in field 'others' (according to #35). For the removal "DataType", I think for now it's ok to remove it, and it can be added (or something similar) back once there is a way forward for eclipse-cdt-cloud/trace-server-protocol#50.

The PR message however, doesn't fully reflect all the changes done in this PR. Could you please give a brief summary in the PR description?

@marco-miller
Copy link
Contributor Author

@marco-miller The code looks good to me. I'm ok to remove the parsing and storing of the unspecified parameters in field 'others' (according to #35). For the removal "DataType", I think for now it's ok to remove it, and it can be added (or something similar) back once there is a way forward for theia-ide/trace-server-protocol#50.

Ack. Thanks for the review.

The PR message however, doesn't fully reflect all the changes done in this PR. Could you please give a brief summary in the PR description?

Done; thanks.

Copy link
Collaborator

@bhufmann bhufmann left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks!

@marco-miller marco-miller merged commit 702bef9 into eclipse-cdt-cloud:master Sep 21, 2021
@marco-miller marco-miller deleted the coverage branch September 21, 2021 12:29
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.

2 participants