Commit ccada0af authored by Philipp Gast's avatar Philipp Gast
Browse files

testing for pep works. Downside is that every whitespace error will result in CI failing...

parent e4b9caa7
Pipeline #475 failed with stage
in 4 minutes and 26 seconds
......@@ -3,3 +3,5 @@ import unittest
from .test_myaxes import TestMyAxes
from .test_myfig import TestMyFig
from .test_grid import TestGrid
from .test_pep import TestCodeFormat
......@@ -16,6 +16,10 @@ states.update({'MyFig': unittest.TextTestRunner(verbosity=verbose).run(suite_myf
suite_grid = unittest.TestLoader().loadTestsFromTestCase(TestGrid)
states.update({'MyGrid': unittest.TextTestRunner(verbosity=verbose).run(suite_grid).wasSuccessful()})
# PEP8
suite_pep8 = unittest.TestLoader().loadTestsFromTestCase(TestCodeFormat)
states.update({'PEP8': unittest.TextTestRunner(verbosity=verbose).run(suite_pep8).wasSuccessful()})
for success in states.items():
if not success[1]:
#!/usr/bin/env python
import os, sys
import unittest
import pep8
class TestCodeFormat(unittest.TestCase):
def test_pep8_conformance(self):
"""Test that we conform to PEP8."""
pep8style = pep8.StyleGuide()
# get current file loc
#~ cpath = os.path.dirname(os.path.abspath(__file__))
#~ print(cpath)
#~ mypl_base = os.path.normpath(cpath+'/../matplotlib')
mypl_base = os.path.relpath('../../')
#~ print(mypl_base)
#~ print(os.listdir(mypl_base))
# list of myplotlib base directory
file_list = os.listdir(mypl_base)
pyfiles = [os.path.join(mypl_base,f) for f in file_list if f.endswith('.py')]
#~ print(pyfiles)
result = pep8style.check_files(pyfiles)
self.assertEqual(result.total_errors, 0,
"Found code style errors (and warnings).")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment