changeset 2290:49188b1e803c

test_sourcecode: only yield tests for *.py files, fixes test count
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 03 Jul 2007 08:58:33 +0200
parents 9d347f8bfd1c
children c5d01f74189a 10be78f1fa97 b902f2397c68
files MoinMoin/_tests/test_sourcecode.py
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_sourcecode.py	Tue Jul 03 02:08:39 2007 +0200
+++ b/MoinMoin/_tests/test_sourcecode.py	Tue Jul 03 08:58:33 2007 +0200
@@ -33,20 +33,19 @@
     error_count = pep8.Checker(path).check_all()
     return error_count
 
-def check_file(reldir, path):
-    if path.lower().endswith('.py'):
-        if TRAILING_SPACES == 'fix':
-            f = file(path, 'rb')
-            data = f.read()
-            f.close()
-            data = FIX_TS_RE.sub('', data)
-            f = file(path, 'wb')
-            f.write(data)
-            f.close()
-        # Please read and follow PEP8 - rerun this test until it does not fail any more,
-        # any type of error is only reported ONCE (even if there are multiple).
-        error_count = pep8_error_count(path)
-        assert error_count == 0
+def check_py_file(reldir, path):
+    if TRAILING_SPACES == 'fix':
+        f = file(path, 'rb')
+        data = f.read()
+        f.close()
+        data = FIX_TS_RE.sub('', data)
+        f = file(path, 'wb')
+        f.write(data)
+        f.close()
+    # Please read and follow PEP8 - rerun this test until it does not fail any more,
+    # any type of error is only reported ONCE (even if there are multiple).
+    error_count = pep8_error_count(path)
+    assert error_count == 0
 
 def test_sourcecode():
     def walk(reldir):
@@ -57,7 +56,8 @@
         else:
             path = ROOT
         if os.path.isfile(path):
-            yield check_file, reldir, path
+            if path.lower().endswith('.py'):
+                yield check_py_file, reldir, path
         elif os.path.isdir(path):
             for entry in os.listdir(path):
                 if not entry.startswith('.'):