[pypy-svn] r54034 - pypy/dist/pypy/rlib/parsing/test

arigo at codespeak.net arigo at codespeak.net
Wed Apr 23 11:34:59 CEST 2008


Author: arigo
Date: Wed Apr 23 11:34:59 2008
New Revision: 54034

Added:
   pypy/dist/pypy/rlib/parsing/test/autopath.py
      - copied unchanged from r54031, pypy/dist/pypy/tool/autopath.py
Modified:
   pypy/dist/pypy/rlib/parsing/test/test_pcre_regtest.py
Log:
Fix this test to make it independent on the current working directory
(e.g. when typing: py.test test/test_pcre_regtest.py).


Modified: pypy/dist/pypy/rlib/parsing/test/test_pcre_regtest.py
==============================================================================
--- pypy/dist/pypy/rlib/parsing/test/test_pcre_regtest.py	(original)
+++ pypy/dist/pypy/rlib/parsing/test/test_pcre_regtest.py	Wed Apr 23 11:34:59 2008
@@ -84,6 +84,8 @@
 from pypy.rlib.parsing.regexparse import make_runner, unescape
 import string
 import re
+import autopath
+this_dir = py.path.local(autopath.this_dir)
 
 #py.test.skip("Still in progress")
 
@@ -123,7 +125,8 @@
 
 def generate_output7():
     """Create the testoutput7.py file from the PCRE file testoutput7"""
-    create_pcre_pickle(open('testoutput7','r'), PythonDumper(open('pcre_test_7.py','w')))
+    create_pcre_pickle(this_dir.join('testoutput7').open(),
+                       PythonDumper(this_dir.join('pcre_test_7.py').open('w')))
 
 def create_pcre_pickle(file, dumper):
     """Create a filtered PCRE test file for the test."""
@@ -295,11 +298,11 @@
             assert match is None
 
 def test_output7():
-    suite = PythonDumper(open('pcre_test_7.py','r')).load()
+    suite = PythonDumper(this_dir.join('pcre_test_7.py').open()).load()
     while suite:
         regex, flags, tests = suite.pop(0)
         yield run_individual_test, regex, tests
 
 if __name__=="__main__":
     for fcn, regex, tests in test_output7():
-        fcn(regex,tests)
\ No newline at end of file
+        fcn(regex,tests)



More information about the Pypy-commit mailing list