From 6284c29c86ef2147ac88656492b53a2dd40f6592 Mon Sep 17 00:00:00 2001 From: Corey Goldberg Date: Thu, 25 Apr 2013 08:30:14 -0400 Subject: [PATCH] added pep8 conformance unittest --- xvfbwrapper/test_xvfb.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xvfbwrapper/test_xvfb.py b/xvfbwrapper/test_xvfb.py index bce1b8e..e0f0e53 100644 --- a/xvfbwrapper/test_xvfb.py +++ b/xvfbwrapper/test_xvfb.py @@ -6,6 +6,8 @@ from .xvfbwrapper import Xvfb import os import unittest +import pep8 + class TestXvfb(unittest.TestCase): @@ -38,5 +40,11 @@ class TestXvfb(unittest.TestCase): self.assertEqual(orig, os.environ['DISPLAY']) -if __name__ == '__main__': - unittest.main(verbosity=2) +class Pep8ConformanceTestCase(unittest.TestCase): + """Test that all code conforms to PEP8.""" + def test_pep8_conformance(self): + # scan entire package recursively starting from root directory + root_dirname = os.path.dirname(os.path.realpath(__file__ + '/..')) + self.pep8style = pep8.StyleGuide() + self.pep8style.input_dir(root_dirname) + self.assertEqual(self.pep8style.options.report.total_errors, 0)