Author: Carl Friedrich Bolz <cfb...@gmx.de>
Branch: 
Changeset: r82564:96b63fbec213
Date: 2016-02-26 14:14 +0100
http://bitbucket.org/pypy/pypy/changeset/96b63fbec213/

Log:    (cfbolz, arigo): have a test that we don't import pypy. from
        rpython/

diff --git a/pypy/tool/test/test_tab.py b/pypy/tool/test/test_tab.py
--- a/pypy/tool/test/test_tab.py
+++ b/pypy/tool/test/test_tab.py
@@ -6,6 +6,7 @@
 from pypy.conftest import pypydir
 
 ROOT = os.path.abspath(os.path.join(pypydir, '..'))
+RPYTHONDIR = os.path.join(ROOT, "rpython")
 EXCLUDE = {'/virt_test/lib/python2.7/site-packages/setuptools'}
 
 
@@ -28,3 +29,27 @@
                 if not entry.startswith('.'):
                     walk('%s/%s' % (reldir, entry))
     walk('')
+
+def test_no_pypy_import_in_rpython():
+    def walk(reldir):
+        print reldir
+        if reldir:
+            path = os.path.join(RPYTHONDIR, *reldir.split('/'))
+        else:
+            path = RPYTHONDIR
+        if os.path.isfile(path):
+            if not path.lower().endswith('.py'):
+                return
+            with file(path) as f:
+                for line in f:
+                    if "import" not in line:
+                        continue
+                    assert "from pypy." not in line
+                    assert "import pypy." not in line
+        elif os.path.isdir(path) and not os.path.islink(path):
+            for entry in os.listdir(path):
+                if not entry.startswith('.'):
+                    walk('%s/%s' % (reldir, entry))
+
+    walk('')
+
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to