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

Appearance settings

Commit d510af0

Browse filesBrowse files
committed
test the pep8 conformance of the mpl examples
1 parent 1d8d5c5 commit d510af0
Copy full SHA for d510af0

File tree

Expand file treeCollapse file tree

1 file changed

+35
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+35
-2
lines changed

‎lib/matplotlib/tests/test_coding_standards.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_coding_standards.py
+35-2Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ def get_file_results(self):
193193

194194
def assert_pep8_conformance(module=matplotlib, exclude_files=EXCLUDE_FILES,
195195
extra_exclude_file=EXTRA_EXCLUDE_FILE,
196-
pep8_additional_ignore=PEP8_ADDITIONAL_IGNORE):
196+
extra_exclude_directories=None,
197+
pep8_additional_ignore=PEP8_ADDITIONAL_IGNORE,
198+
dirname=None):
197199
"""
198200
Tests the matplotlib codebase against the "pep8" tool.
199201
@@ -228,7 +230,12 @@ def assert_pep8_conformance(module=matplotlib, exclude_files=EXCLUDE_FILES,
228230
extra_exclude = [line.strip() for line in fh if line.strip()]
229231
pep8style.options.exclude.extend(extra_exclude)
230232

231-
result = pep8style.check_files([os.path.dirname(module.__file__)])
233+
if extra_exclude_directories:
234+
pep8style.options.exclude.extend(extra_exclude_directories)
235+
236+
if dirname is None:
237+
dirname = os.path.dirname(module.__file__)
238+
result = pep8style.check_files([dirname])
232239
if reporter is StandardReportWithExclusions:
233240
msg = ("Found code syntax errors (and warnings):\n"
234241
"{0}".format('\n'.join(reporter._global_deferred_print)))
@@ -253,6 +260,32 @@ def test_pep8_conformance():
253260
assert_pep8_conformance()
254261

255262

263+
def test_pep8_conformance_examples():
264+
exdir = os.path.join(os.getcwd(), '..', '..', '..', 'examples')
265+
blacklist = ['color',
266+
'event_handling',
267+
'images_contours_and_fields',
268+
'lines_bars_and_markers',
269+
'misc',
270+
'mplot3d',
271+
'pie_and_polar_charts',
272+
'pylab_examples',
273+
'shapes_and_collections',
274+
'showcase',
275+
'specialty_plots',
276+
'statistics',
277+
'style_sheets',
278+
'subplots_axes_and_figures',
279+
'tests',
280+
'text_labels_and_annotations',
281+
'ticks_and_spines',
282+
'units',
283+
'user_interfaces',
284+
'widgets']
285+
assert_pep8_conformance(dirname=exdir,
286+
extra_exclude_directories=blacklist)
287+
288+
256289
if __name__ == '__main__':
257290
import nose
258291
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.