Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9c8dda

Browse files
committed
Merge pull request matplotlib#2103 from mdboom/pep8-skip-when-pep8-not-installed
Skip the pep8 conformance test when the pep8 tool is not installed
2 parents 42301ea + c265eb9 commit f9c8dda

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/matplotlib/tests/test_coding_standards.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
import sys
44

55
from nose.tools import assert_equal
6-
import pep8
6+
from nose.plugins.skip import SkipTest
7+
8+
try:
9+
import pep8
10+
except ImportError:
11+
HAS_PEP8 = False
12+
else:
13+
HAS_PEP8 = True
714

815
import matplotlib
916

@@ -172,6 +179,9 @@ def _test_pep8_conformance():
172179
# The file should be a line separated list of filenames/directories
173180
# as can be passed to the "pep8" tool's exclude list.
174181

182+
if not HAS_PEP8:
183+
raise SkipTest('The pep8 tool is required for this test')
184+
175185
# Only run this test with Python 2 - the 2to3 tool generates non pep8
176186
# compliant code.
177187
if sys.version_info[0] != 2:

0 commit comments

Comments
 (0)