Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tweak coverage#8036

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dstansby merged 10 commits intomatplotlib:masterfromdopplershift:tweak-coverage
Feb 20, 2017
Merged

Conversation

dopplershift
Copy link
Contributor

Mainly to turn on coverage for all testing on AppVeyor, as well as tighten our expected threshold for the test lines.

WIP because I want to investigate some of the test files that aren't at 100%.

@dopplershift
Copy link
ContributorAuthor

Oh goody, we had two tests with the same name, so only the second ran (luckily it now succeeds here, and it's only a smoke test).

Anyone know a good way to check for this within our test suite--besides checking files with seemingly low test coverage %?

@dopplershift
Copy link
ContributorAuthor

dopplershift commentedFeb 7, 2017
edited
Loading

More fun:

  • Completely duplicated test methods inTest_detrend intest_mlab.py
  • Intest_pickle.py,recursive_pickle (and hencedepth_getter) are completely unused in living code--they're commented out debugging helpers. Suggestions on where else we could put them? Or can we remove?

@QuLogic
Copy link
Member

QuLogic commentedFeb 7, 2017
edited
Loading

For top-level functions, this is relatively easy:

$ grep -IRo '^def[[:space:]]\+[A-Za-z0-9_]\+' | sort | uniq -dtest_axes.py:def test_pcolorargstest_contour.py:def test_contour_manual_labels

For class methods, maybe a short Python script:

importsysfromcollectionsimportCounterfornameinsys.argv[1:]:methods=Counter()class_name=Nonewithopen(name,'r')asf:forlineinf:ifline.startswith('class'):class_name=line.split()[1].split('(')[0].strip()elifline.startswith('def'):class_name=Noneelifclass_nameandline.startswith('    def'):method_name=line.split()[1].split('(')[0].strip()methods[class_name+'.'+method_name]+=1duplicates= [nameforname,countinmethods.most_common()ifcount!=1]ifduplicates:print(name,duplicates)
test_mlab.py ['Test_detrend.test_detrend_mean_2D_axism1', 'Test_detrend.test_detrend_mean_2D_none', 'Test_detrend.test_detrend_mean_2D_axis0', 'Test_detrend.test_detrend_str_linear_2d_slope_off_axis0', 'Test_detrend.test_detrend_mean_2D_none_T', 'Test_detrend.test_detrend_mean_2D_axis1', 'Test_detrend.test_detrend_detrend_linear_1d_slope_off_axis1']test_skew.py ['SkewXTick.tick2On', 'SkewXTick.gridOn', 'SkewXTick.tick1On', 'SkewXTick.label2On', 'SkewXTick.label1On']

@QuLogic
Copy link
Member

QuLogic commentedFeb 7, 2017
edited
Loading

For top-level classes, too:

$ grep -IRo '^class[[:space:]]\+[A-Za-z0-9_]\+' | sort | uniq -dtest_ticker.py:class TestLogFormatter

@tacaswelltacaswell added this to the2.1 (next point release) milestoneFeb 7, 2017
@tacaswell
Copy link
Member

I am 👍 on removing the pickle debugging helpers. I have 0 pity on people depending on helper functions from in our tests (not intesting, in the tests). We have already broken those folks by default by not including the tests anyway.

NelleV reacted with thumbs up emoji

@@ -158,7 +158,7 @@ def test_contour_manual_labels():

@image_comparison(baseline_images=['contour_labels_size_color'],
extensions=['png'], remove_text=True)
deftest_contour_manual_labels():
deftest_contour_labels_size_color():

Copy link
Member

Choose a reason for hiding this comment

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

Travis is failing on this image comparison. I'm guessing this just needs an updated image, since it's been a while since this test was ever run.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Updated. Surprisingly, that's the only test that had that problem. The other newly activated tests pass, thankfully.

Copy link
Member

Choose a reason for hiding this comment

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

How are we handling regenerating images as a policy?

See#7905

I think we'll shortly have to revert this changed image when/if#7970 is merged.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I'm happy to wait on this until the other is decided upon.

Copy link
Member

Choose a reason for hiding this comment

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

Cool. I think everything else is A+, 👍 so far.

Trying to ensure we don't backslide.
This was causing the first test to not run.
Regenerate test images now that this test is actually run.
This was an exact duplicate of the code above it.
This was deflating our coverage numbers for the tests. If deemednecessary, this code should be resurrected elsewhere (outside tests).Also cleaned up the code a bit.
Lack of saving the animation caused it to never run the callbacks.
@dopplershift
Copy link
ContributorAuthor

It's been a good exercise. All of the test files with significant uncovered lines were caused by either dead code or tests that weren't running.

I noticed a significant number of uncovered lines left are caused bypass. Thoughts on addingpass to our exclude list in.coveragerc? Or is that cheating?

Remove unused code and restructure to eliminate uncovered lines.
Since we're here making changes anyways.
@dopplershift
Copy link
ContributorAuthor

dopplershift commentedFeb 7, 2017
edited
Loading

Another question: Currently, ourmatplotlib.testing stands at ~57% coverage because all the nose stuff is disabled. Do we want to exclude the nose testing code from the report?

@NelleV
Copy link
Member

I think both solutions are fine, with a slight preference in keeping it.
The day we will get rid of this code, our coverage will just jump up.

tacaswell reacted with thumbs up emoji

@@ -1464,7 +1488,8 @@ def _as_mpl_axes(self):
ax_via_gca = plt.gca(projection=prj2)
assert ax_via_gca is not ax
assert ax.get_theta_offset() == 0, ax.get_theta_offset()
assert ax_via_gca.get_theta_offset() == np.pi, ax_via_gca.get_theta_offset()
assert ax_via_gca.get_theta_offset() == np.pi, \
Copy link
Member

Choose a reason for hiding this comment

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

do we need the second part of the assert with pytest?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Oh, I guess not.

assert xax._major_tick_kw['tick2On'] == True
assert xax._minor_tick_kw['tick1On'] == False
assert xax._minor_tick_kw['tick2On'] == True
assert not xax._major_tick_kw['tick1On']
Copy link
Member

Choose a reason for hiding this comment

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

These are slightly different tests asassert 'aardvark' passes, butassert 'aardvark' == True does not.

Do we care about this change?

@dopplershift
Copy link
ContributorAuthor

Anyone have opinions on whether we should be ignoringpass lines for test coverage? We currently exclude:

    raise NotImplemented    def __str__    def __repr__    if __name__ == .__main__.:

@tacaswell
Copy link
Member

I don't think we should skippass lines. Either we have non-functional code (as in the body is justpass and it really should beNotImplemented or theypass lines are in fall-troughs of input sanitation/validation which if we miss them, there is a case of inputs we are missing in the tests.

@dopplershift
Copy link
ContributorAuthor

I think a lot of these are stubs in interfaces in the tests. I'm leaning towards turning them into some variety ofNotImplemented such that they break should they be used.

Copy link
Member

@dstansbydstansby 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.

re. the new test image, the image would/should have been regenerated a while ago, so adding it even if it'll be changed soon seems fine to me.

@dstansbydstansby merged commitcf0d260 intomatplotlib:masterFeb 20, 2017
@dopplershiftdopplershift deleted the tweak-coverage branchFebruary 21, 2017 19:52
@QuLogicQuLogic changed the title[WIP] Tweak coverageTweak coverageFeb 26, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@phobsonphobsonphobson left review comments

@tacaswelltacaswelltacaswell approved these changes

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v2.1
Development

Successfully merging this pull request may close these issues.

6 participants
@dopplershift@QuLogic@tacaswell@NelleV@phobson@dstansby

[8]ページ先頭

©2009-2025 Movatter.jp