From 70c0990403574b2949d101e73b225fea408fcbef Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Fri, 26 Jun 2015 01:14:23 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Moved=20exceptions=20that=20don=E2=80=99t?= =?UTF-8?q?=20depend=20on=20nose=20to=20separate=20file=20to=20avoid=20mak?= =?UTF-8?q?ing=20nose=20a=20dependency=20for=20matplotlib.testing.compare?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/matplotlib/testing/compare.py | 2 +- lib/matplotlib/testing/exceptions.py | 10 ++++++++++ lib/matplotlib/testing/noseclasses.py | 14 +++----------- 3 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 lib/matplotlib/testing/exceptions.py diff --git a/lib/matplotlib/testing/compare.py b/lib/matplotlib/testing/compare.py index 0495a7ae2f42..ed864abbdb69 100644 --- a/lib/matplotlib/testing/compare.py +++ b/lib/matplotlib/testing/compare.py @@ -15,7 +15,7 @@ import matplotlib from matplotlib.compat import subprocess -from matplotlib.testing.noseclasses import ImageComparisonFailure +from matplotlib.testing.exceptions import ImageComparisonFailure from matplotlib import _png from matplotlib import _get_cachedir from matplotlib import cbook diff --git a/lib/matplotlib/testing/exceptions.py b/lib/matplotlib/testing/exceptions.py new file mode 100644 index 000000000000..931132ddec4b --- /dev/null +++ b/lib/matplotlib/testing/exceptions.py @@ -0,0 +1,10 @@ +class KnownFailureTest(Exception): + '''Raise this exception to mark a test as a known failing test.''' + pass + +class KnownFailureDidNotFailTest(Exception): + '''Raise this exception to mark a test should have failed but did not.''' + pass + +class ImageComparisonFailure(AssertionError): + '''Raise this exception to mark a test as a comparison between two images.''' diff --git a/lib/matplotlib/testing/noseclasses.py b/lib/matplotlib/testing/noseclasses.py index 4c28df243f68..9b02e2991d86 100644 --- a/lib/matplotlib/testing/noseclasses.py +++ b/lib/matplotlib/testing/noseclasses.py @@ -5,17 +5,9 @@ import os from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin - -class KnownFailureTest(Exception): - '''Raise this exception to mark a test as a known failing test.''' - pass - -class KnownFailureDidNotFailTest(Exception): - '''Raise this exception to mark a test should have failed but did not.''' - pass - -class ImageComparisonFailure(AssertionError): - '''Raise this exception to mark a test as a comparison between two images.''' +from matplotlib.testing.exceptions import (KnownFailureTest, + KnownFailureDidNotFailTest, + ImageComparisonFailure) class KnownFailure(ErrorClassPlugin): '''Plugin that installs a KNOWNFAIL error class for the From 66dd5507b9accf35fa561fc4a9fdaa3e1428762a Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Fri, 26 Jun 2015 09:58:36 +0100 Subject: [PATCH 2/3] PEP8 fixes --- lib/matplotlib/testing/exceptions.py | 16 +++++++++++----- lib/matplotlib/testing/noseclasses.py | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/testing/exceptions.py b/lib/matplotlib/testing/exceptions.py index 931132ddec4b..b549d89205ec 100644 --- a/lib/matplotlib/testing/exceptions.py +++ b/lib/matplotlib/testing/exceptions.py @@ -1,10 +1,16 @@ class KnownFailureTest(Exception): - '''Raise this exception to mark a test as a known failing test.''' - pass + """ + Raise this exception to mark a test as a known failing test. + """ + class KnownFailureDidNotFailTest(Exception): - '''Raise this exception to mark a test should have failed but did not.''' - pass + """ + Raise this exception to mark a test should have failed but did not. + """ + class ImageComparisonFailure(AssertionError): - '''Raise this exception to mark a test as a comparison between two images.''' + """ + Raise this exception to mark a test as a comparison between two images. + """ diff --git a/lib/matplotlib/testing/noseclasses.py b/lib/matplotlib/testing/noseclasses.py index 9b02e2991d86..8bcb09d28a29 100644 --- a/lib/matplotlib/testing/noseclasses.py +++ b/lib/matplotlib/testing/noseclasses.py @@ -9,6 +9,7 @@ KnownFailureDidNotFailTest, ImageComparisonFailure) + class KnownFailure(ErrorClassPlugin): '''Plugin that installs a KNOWNFAIL error class for the KnownFailureClass exception. When KnownFailureTest is raised, @@ -38,7 +39,7 @@ def configure(self, options, conf): if disable: self.enabled = False - def addError( self, test, err, *zero_nine_capt_args ): + def addError(self, test, err, *zero_nine_capt_args): # Fixme (Really weird): if I don't leave empty method here, # nose gets confused and KnownFails become testing errors when # using the MplNosePlugin and MplTestCase. From 2371d19a12f1ac82974467562d1f3218dee4dbc7 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Fri, 26 Jun 2015 14:17:45 +0100 Subject: [PATCH 3/3] Remove nosetests from list of PEP8-failing modules --- lib/matplotlib/tests/test_coding_standards.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/matplotlib/tests/test_coding_standards.py b/lib/matplotlib/tests/test_coding_standards.py index 55556924fbef..4358ca310965 100644 --- a/lib/matplotlib/tests/test_coding_standards.py +++ b/lib/matplotlib/tests/test_coding_standards.py @@ -194,7 +194,6 @@ def test_pep8_conformance_installed_files(): 'type1font.py', 'widgets.py', 'testing/decorators.py', - 'testing/noseclasses.py', 'testing/jpl_units/Duration.py', 'testing/jpl_units/Epoch.py', 'testing/jpl_units/EpochConverter.py',