changeset 2275:023e0f0d264e

tests: rename test_tab to test_sourcecode, also test for sourcefiles not ending with a newline char
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 02 Jul 2007 16:06:54 +0200
parents 01f6172dabd0
children e56af6f9b2cc
files MoinMoin/_tests/test_sourcecode.py MoinMoin/_tests/test_tab.py MoinMoin/xmlrpc/_tests/test_multicall.py
diffstat 3 files changed, 44 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/_tests/test_sourcecode.py	Mon Jul 02 16:06:54 2007 +0200
@@ -0,0 +1,43 @@
+"""
+Verify that the MoinMoin source files have no tabs.
+
+@copyright: 2006 by Armin Rigo,
+            2007 adapted for MoinMoin by MoinMoin:ThomasWaldmann.
+@license: MIT licensed
+"""
+
+import os
+
+from MoinMoin.conftest import moindir
+
+ROOT = str(moindir)
+
+EXCLUDE = [
+     '/MoinMoin/support', # 3rd party libs or non-broken stdlib stuff
+    '/wiki/htdocs/applets/FCKeditor', # 3rd party GUI editor
+]
+
+def test_no_tabs():
+    def walk(reldir):
+        if reldir in EXCLUDE:
+            return
+        if reldir:
+            path = os.path.join(ROOT, *reldir.split('/'))
+        else:
+            path = ROOT
+        if os.path.isfile(path):
+            if path.lower().endswith('.py'):
+                f = open(path, 'r')
+                data = f.read()
+                f.close()
+                assert '\t' not in data, "%r contains tabs!" % (reldir,)
+                assert not data or data.endswith('\n'), "%r does not end with a newline char!" % (reldir,)
+        elif os.path.isdir(path):
+            for entry in os.listdir(path):
+                if not entry.startswith('.'):
+                    walk('%s/%s' % (reldir, entry))
+
+    global EXCLUDE
+    EXCLUDE = dict([(path, True) for path in EXCLUDE]) # dict lookup is faster
+    walk('')
+
--- a/MoinMoin/_tests/test_tab.py	Mon Jul 02 15:57:35 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-"""
-Verify that the MoinMoin source files have no tabs.
-
-@copyright: 2006 by Armin Rigo,
-            2007 adapted for MoinMoin by MoinMoin:ThomasWaldmann.
-@license: MIT licensed
-"""
-
-import os
-
-from MoinMoin.conftest import moindir
-
-ROOT = str(moindir)
-
-EXCLUDE = [
-    '/wiki/htdocs/applets/FCKeditor',
-]
-
-def test_no_tabs():
-    def walk(reldir):
-        if reldir in EXCLUDE:
-            return
-        if reldir:
-            path = os.path.join(ROOT, *reldir.split('/'))
-        else:
-            path = ROOT
-        if os.path.isfile(path):
-            if path.lower().endswith('.py'):
-                f = open(path, 'r')
-                data = f.read()
-                f.close()
-                assert '\t' not in data, "%r contains tabs!" % (reldir,)
-        elif os.path.isdir(path):
-            for entry in os.listdir(path):
-                if not entry.startswith('.'):
-                    walk('%s/%s' % (reldir, entry))
-
-    global EXCLUDE
-    EXCLUDE = dict([(path, True) for path in EXCLUDE]) # dict lookup is faster
-    walk('')
-
--- a/MoinMoin/xmlrpc/_tests/test_multicall.py	Mon Jul 02 15:57:35 2007 +0200
+++ b/MoinMoin/xmlrpc/_tests/test_multicall.py	Mon Jul 02 16:06:54 2007 +0200
@@ -25,4 +25,4 @@
     result = xmlrpc.xmlrpc_system_multicall(args)
     assert(type(result[0]) == dict)
     assert(result[0].has_key("faultCode") and result[0].has_key("faultString"))
-    
\ No newline at end of file
+