[pypy-svn] r38464 - pypy/dist/pypy/module/_sre/test

arigo at codespeak.net arigo at codespeak.net
Sun Feb 11 15:25:33 CET 2007


Author: arigo
Date: Sun Feb 11 15:25:32 2007
New Revision: 38464

Modified:
   pypy/dist/pypy/module/_sre/test/test_app_sre.py
Log:
Change the obscure path hacks to make "py.test -A" happy.


Modified: pypy/dist/pypy/module/_sre/test/test_app_sre.py
==============================================================================
--- pypy/dist/pypy/module/_sre/test/test_app_sre.py	(original)
+++ pypy/dist/pypy/module/_sre/test/test_app_sre.py	Sun Feb 11 15:25:32 2007
@@ -1,15 +1,14 @@
 """Regular expression tests specific to _sre.py and accumulated during TDD."""
+import autopath
 from py.test import raises, skip
 from pypy.interpreter.gateway import app2interp_temp
 
 def init_globals_hack(space):
-    space.appexec([], """():
+    space.appexec([autopath.this_dir], """(this_dir):
     import __builtin__ as b
     import sys, os.path
     # Uh-oh, ugly hack
-    test_path = os.path.join(
-        os.path.dirname(sys.modules["sys"].__file__), "../_sre/test")
-    sys.path.insert(0, test_path)
+    sys.path.insert(0, this_dir)
     import support_test_app_sre
     b.s = support_test_app_sre
     sys.path.pop(0)
@@ -189,6 +188,12 @@
             return ret
         assert ("bbbbb", 3) == re.subn("a", call_me, "ababa")
 
+    def test_match_array(self):
+        import re, array
+        a = array.array('c', 'hello')
+        m = re.match('hel+', a)
+        assert m.end() == 4
+
 
 class AppTestSreScanner:
 



More information about the Pypy-commit mailing list