Author: Armin Rigo <[email protected]>
Branch: stm-gc
Changeset: r54673:3e95a592df1e
Date: 2012-04-23 12:15 +0200
http://bitbucket.org/pypy/pypy/changeset/3e95a592df1e/

Log:    Fix test to run even if the working directory is different.

diff --git a/pypy/translator/stm/test/test_stmgcintf.py 
b/pypy/translator/stm/test/test_stmgcintf.py
--- a/pypy/translator/stm/test/test_stmgcintf.py
+++ b/pypy/translator/stm/test/test_stmgcintf.py
@@ -1,14 +1,22 @@
 import os
+from pypy.tool import autopath
 from pypy.tool.udir import udir
 
 
 def test_all():
     executable = str(udir.join('test_stmgcintf'))
-    exitcode = os.system("gcc -g -o '%s' -pthread -I.. test_stmgcintf.c" % (
-        executable,))
-    assert exitcode == 0
+    prevdir = os.getcwd()
+    thisdir = os.path.join(autopath.pypydir, 'translator', 'stm', 'test')
+    try:
+        os.chdir(thisdir)
+        exitcode = os.system(
+            "gcc -g -o '%s' -pthread -I.. test_stmgcintf.c" % (
+            executable,))
+        assert exitcode == 0
+    finally:
+        os.chdir(prevdir)
     #
-    for line in open('test_stmgcintf.c'):
+    for line in open(os.path.join(thisdir, 'test_stmgcintf.c')):
         line = line.strip()
         if line.startswith('XTEST('):
             assert line.endswith(');')
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to