[pypy-svn] r31198 - pypy/dist/pypy/tool/test

arigo at codespeak.net arigo at codespeak.net
Wed Aug 9 13:08:37 CEST 2006


Author: arigo
Date: Wed Aug  9 13:08:36 2006
New Revision: 31198

Added:
   pypy/dist/pypy/tool/test/test_tab.py   (contents, props changed)
Log:
A test for tabs in the source files.


Added: pypy/dist/pypy/tool/test/test_tab.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/tool/test/test_tab.py	Wed Aug  9 13:08:36 2006
@@ -0,0 +1,30 @@
+"""
+Verify that the PyPy source files have no tabs.
+"""
+
+import autopath
+import os
+
+ROOT = autopath.pypydir
+EXCLUDE = {'/translator/pyrex/Pyrex': True}
+
+
+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))
+    walk('')



More information about the Pypy-commit mailing list