changeset 2273:80c083a0e4a7

tests: test for source files containing tabs, thanks to Armin Rigo
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 02 Jul 2007 15:52:48 +0200
parents 2aa65d5835d4
children 01f6172dabd0
files MoinMoin/_tests/test_tab.py
diffstat 1 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/_tests/test_tab.py	Mon Jul 02 15:52:48 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/parser',
+    '/MoinMoin/formatter',
+    '/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('')
+