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 4a0f5f4

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

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+38
-2
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ script:
3434
# Generate the font caches in a single process before starting the
3535
# multiple processes
3636
- python -c "from matplotlib import font_manager"
37+
- if [[ $BUILD_DOCS == false ]]; then export MPL_REPO_DIR=$PWD; fi # pep8-conformance test of the examples
3738
- if [[ $BUILD_DOCS == false ]]; then mkdir ../tmp_test_dir; fi
3839
- if [[ $BUILD_DOCS == false ]]; then cd ../tmp_test_dir; fi
3940
- if [[ $BUILD_DOCS == false ]]; then python ../matplotlib/tests.py -sv --processes=8 --process-timeout=300 $TEST_ARGS; fi

‎lib/matplotlib/tests/test_coding_standards.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_coding_standards.py
+37-2Lines changed: 37 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,34 @@ def test_pep8_conformance():
253260
assert_pep8_conformance()
254261

255262

263+
def test_pep8_conformance_examples():
264+
mpldirdefault = os.path.join(os.getcwd(), '..', '..', '..')
265+
mpldir = os.environ.get('MPL_REPO_DIR', mpldirdefault)
266+
exdir = os.path.join(mpldir, 'examples')
267+
blacklist = ['color',
268+
'event_handling',
269+
'images_contours_and_fields',
270+
'lines_bars_and_markers',
271+
'misc',
272+
'mplot3d',
273+
'pie_and_polar_charts',
274+
'pylab_examples',
275+
'shapes_and_collections',
276+
'showcase',
277+
'specialty_plots',
278+
'statistics',
279+
'style_sheets',
280+
'subplots_axes_and_figures',
281+
'tests',
282+
'text_labels_and_annotations',
283+
'ticks_and_spines',
284+
'units',
285+
'user_interfaces',
286+
'widgets']
287+
assert_pep8_conformance(dirname=exdir,
288+
extra_exclude_directories=blacklist)
289+
290+
256291
if __name__ == '__main__':
257292
import nose
258293
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.