Prepare for cross-framework test suite #6920

Merged
merged 1 commit into from Aug 20, 2016

Conversation

Projects
None yet
7 participants
Member

Kojoley commented Aug 7, 2016

I have made a separated PR for this commit because I need a review for it (this is the base for other changes related to pytest framework support).

Changes:

  • introduced xfail(reason) function
    • uses: raise KnownFailureTest(msg) -> xfail(reason)
    • same name and signature as in pytest
  • introduced skip(reason) function
    • uses: raise SkipTest(msg) -> skip(reason)
    • same name and signature as in pytest
  • introduced skipif(condition, reason=None) decorator
    • uses: replaces def func(): if condition: skip()
    • same name and signature as in pytest
      • can be used with functions, classes, and methods
      • supports string condition (evaluated at runtime)
  • moved nose related code to testing.nose submodule
    • plugins in testing.nose.plugins submodule
    • decorators implementation in testing.nose.decorators
      (interface is still in testing.decorators, implementation will
      have been chosen at runtime according to used test framework)
  • matplotlib.test function unifications
  • tests.py now uses matplotlib.test()

mdboom added the needs_review label Aug 7, 2016

Owner

jenshnielsen commented Aug 8, 2016

👍 from my first quick read of the changes

Member

Kojoley commented Aug 8, 2016

Small fix: rcParams['backend'] -> get_backend()

@QuLogic QuLogic commented on the diff Aug 8, 2016

lib/matplotlib/__init__.py
@@ -1580,70 +1580,17 @@ def _init_tests():
)
)
- try:
- import nose
- try:
- from unittest import mock
@QuLogic

QuLogic Aug 8, 2016

Member

mock is used in other tests; not sure this test should be removed.

@Kojoley

Kojoley Aug 8, 2016

Member

Check is not removed, it is just moved to check_deps function

story645 referenced this pull request Aug 10, 2016

Open

[WIP] Categorical Color Mapping #6934

1 of 5 tasks complete

tacaswell added this to the 2.1 (next point release) milestone Aug 13, 2016

Owner

tacaswell commented Aug 13, 2016

This needs a rebase

@Kojoley Kojoley Prepare for cross-framework test suite
  - introduced `xfail(reason)` function
    - uses: `raise KnownFailureTest(msg)` -> `xfail(reason)`
    - same name and signature as in pytest

  - introduced `skip(reason)` function
    - uses: `raise SkipTest(msg)` -> `skip(reason)`
    - same name and signature as in pytest

  - introduced `skipif(condition, reason=None)` decorator
    - uses: replaces `def func(): if condition: skip()`
    - same name and signature as in pytest
    - can be used with functions, classes, and methods
    - supports string condition (evaluated at runtime)

  - moved nose related code to `testing.nose` submodule
    - plugins in `testing.nose.plugins` submodule
    - decorators implementation in `testing.nose.decorators`
      (interface is still in `testing.decorators`, implementation will
       have been chosen at runtime according to used test framework)

  - `matplotlib.test` function unifications
  - `tests.py` now uses `matplotlib.test()`
f20efb9
Member

Kojoley commented Aug 16, 2016

Ping

@tacaswell tacaswell commented on the diff Aug 17, 2016

lib/matplotlib/testing/exceptions.py
@@ -1,15 +1,3 @@
-class KnownFailureTest(Exception):
@tacaswell

tacaswell Aug 17, 2016

Owner

I would rather not move this for compatibility reasons.

@WeatherGod

WeatherGod Aug 17, 2016

Member

Yeah, I am pretty sure other projects actually uses our KnownFailure stuff.

On Wed, Aug 17, 2016 at 1:15 PM, Thomas A Caswell notifications@github.com
wrote:

In lib/matplotlib/testing/exceptions.py
#6920 (comment):

@@ -1,15 +1,3 @@
-class KnownFailureTest(Exception):

I would rather not move this for compatibility reasons.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/matplotlib/matplotlib/pull/6920/files/f20efb99d67e581f18f8fd58db07d6279528fcbd#r75165500,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AARy-A6W8iBehFuv_ltVBw91aSSmfrI6ks5qg0GmgaJpZM4Jemgm
.

@Kojoley

Kojoley Aug 17, 2016

Member

I cannot agree with this for two reasons:

  • PRs that relay on raise KnownFailureTest should not pass after this PR ever, and this change will force them to switch on xfail
  • Other projects must not relay on matplotlib testing features, it is their problem if they are

I can understand backward compatibility on matplotlib core features, but with removing nose support all this stuff will gone. I have already tried my best to make dual nose-pytest support, but leaving nose-specific stuff on the current places will blow something in any time in the future.

@WeatherGod

WeatherGod Aug 17, 2016

Member

Just to note, matplotlib and many other projects depend on some of numpy's
testing features. By your logic, that shouldn't be done and every project
should implement their own numerical comparison tools?

I am not exactly sure how to proceed here.

On Wed, Aug 17, 2016 at 1:31 PM, Nikita Kniazev notifications@github.com
wrote:

In lib/matplotlib/testing/exceptions.py
#6920 (comment):

@@ -1,15 +1,3 @@
-class KnownFailureTest(Exception):

I cannot agree with this for two reasons:

  • PRs that relay on raise KnownFailureTest should not pass after this
    PR ever, and this change will force them to switch on xfail
  • Other projects must not relay on matplotlib testing features, it is
    their problem if they are

I can understand backward compatibility on matplotlib core features, but
with removing nose support all this stuff will gone. I have already tried
my best to make dual nose-pytest support, but leaving nose-specific stuff
on the current places will blow something in any time in the future.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/matplotlib/matplotlib/pull/6920/files/f20efb99d67e581f18f8fd58db07d6279528fcbd#r75168432,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AARy-HYvL9iMog7FVqaAIeBGMR-v5ev-ks5qg0WIgaJpZM4Jemgm
.

@Kojoley

Kojoley Aug 17, 2016

Member

By my logic - anything that is not a part of the public API can be changed or even removed at any time, so everyone who did something like using KnownFailureTest makes it on its own risk.

@dopplershift

dopplershift Aug 17, 2016

Contributor

Numpy's tools are useful for testing using numpy arrays, so I don't find referencing them to be a compelling argument. The exceptions removed here are not unique to matplotlib functionality. It was a bad idea to for people to use them from us in the first place, and are trivially recreated for anyone down stream who happen to use them.

tacaswell closed this Aug 20, 2016

tacaswell reopened this Aug 20, 2016

@tacaswell tacaswell added needs_review and removed needs_review labels Aug 20, 2016

Owner

tacaswell commented Aug 20, 2016

'powercycled to try and trigger coveralls

Owner

tacaswell commented Aug 20, 2016

Merging this as it is blocking progress for @story645

Independent of if the testing code should be part of the public API, people are using it that way (and to my knowledge) we have not been actively discouraging it. We are going to have to eventually shim these back or document the API changes.

Owner

tacaswell commented Aug 20, 2016

and the travis failure is an install failure on the basemap dependency.

@tacaswell tacaswell merged commit 00e6c38 into matplotlib:master Aug 20, 2016

1 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
coverage/coveralls Coverage remained the same at 70.284%
Details

tacaswell removed the needs_review label Aug 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment