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 context reporting for relative_files #902

Merged
merged 1 commit into from
Dec 21, 2019

Conversation

davidszotten
Copy link
Contributor

fix reporting of contexts when relative_files = True

fixes #900

fix reporting of contexts when `relative_files = True`

fixes nedbat#900
'covered_lines': 2,
'num_statements': 3,
'percent_covered': 66.66666666666667
for relative_files in [False, True]:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

easier to look at this diff at https://github.com/nedbat/coveragepy/pull/902/files?w=1 (hiding whitespace changes)

i tried to use pytest parametrize but it doesn't work with unitttest tests

Copy link
Owner

Choose a reason for hiding this comment

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

In cases like this, i've used helper functions. I'll make that change. I really appreciate that you updated the tests, and thought about how best to update them. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you!

@@ -1127,3 +1127,20 @@ def test_no_contexts_warns_no_contexts(self):
self.start_import_stop(cov, "two_tests")
with self.assert_warnings(cov, ["No contexts were measured"]):
cov.html_report()

def test_dynamic_contexts_relative_files(self):
self.make_file("two_tests.py", self.SOURCE)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this test was much smaller than the json one, so i duplicated it. do you have a preference of approach?

@codecov-io
Copy link

codecov-io commented Dec 20, 2019

Codecov Report

Merging #902 into master will decrease coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #902      +/-   ##
==========================================
- Coverage   94.19%   94.16%   -0.04%     
==========================================
  Files          86       86              
  Lines       11870    11887      +17     
  Branches     1185     1188       +3     
==========================================
+ Hits        11181    11193      +12     
- Misses        560      566       +6     
+ Partials      129      128       -1
Impacted Files Coverage Δ
coverage/jsonreport.py 100% <100%> (ø) ⬆️
tests/test_html.py 99.62% <100%> (ø) ⬆️
tests/test_json.py 100% <100%> (ø) ⬆️
coverage/html.py 100% <100%> (ø) ⬆️
tests/test_debug.py 90.38% <0%> (-7.7%) ⬇️
tests/test_arcs.py 100% <0%> (+1.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c09c2c2...b980a0a. Read the comment docs.

@nedbat nedbat merged commit ade1f2c into nedbat:master Dec 21, 2019
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.

relative_files = True and dynamic_context = test_function
3 participants