Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1.  
  2. import os
  3. import unittest
  4.  
  5. import pep8
  6.  
  7.  
  8. class Pep8Test(unittest.TestCase):
  9.  
  10. def test_pep8(self):
  11. style = pep8.StyleGuide()
  12. style.options.max_line_length = 100 # Set this to desired maximum line length
  13. filenames = []
  14. for root, _, files in os.walk('[folder path]'): # Set this to desired folder location
  15. python_files = [f for f in files if f.endswith('.py')]
  16. for file in python_files:
  17. filename = '{0}/{1}'.format(root, file)
  18. filenames.append(filename)
  19. check = style.check_files(filenames)
  20. self.assertEqual(check.total_errors, 0, 'PEP8 style errors: %d' % check.total_errors)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement