tests: adapt the test runner to work with jython
authorRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
Tue, 23 Mar 2010 11:37:31 +0100
changeset 10758 2ed667a9dfcb
parent 10757 ab3782458827
child 10763 68a7b9ed3c71
tests: adapt the test runner to work with jython
tests/run-tests.py
--- a/tests/run-tests.py	Tue Mar 23 11:37:01 2010 +0100
+++ b/tests/run-tests.py	Tue Mar 23 11:37:31 2010 +0100
@@ -70,6 +70,9 @@
 SKIPPED_PREFIX = 'skipped: '
 FAILED_PREFIX  = 'hghave check failed: '
 PYTHON = sys.executable
+IMPL_PATH = 'PYTHONPATH'
+if 'java' in sys.platform:
+    IMPL_PATH = 'JYTHONPATH'
 
 requiredtools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"]
 
@@ -140,6 +143,9 @@
     parser.set_defaults(**defaults)
     (options, args) = parser.parse_args()
 
+    # jython is always pure
+    options.pure = options.pure or 'java' in sys.platform
+
     if options.with_hg:
         if not (os.path.isfile(options.with_hg) and
                 os.access(options.with_hg, os.X_OK)):
@@ -907,10 +913,10 @@
         # it, in case external libraries are only available via current
         # PYTHONPATH.  (In particular, the Subversion bindings on OS X
         # are in /opt/subversion.)
-        oldpypath = os.environ.get('PYTHONPATH')
+        oldpypath = os.environ.get(IMPL_PATH)
         if oldpypath:
             pypath.append(oldpypath)
-        os.environ['PYTHONPATH'] = os.pathsep.join(pypath)
+        os.environ[IMPL_PATH] = os.pathsep.join(pypath)
 
     COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
 
@@ -931,7 +937,7 @@
     vlog("# Using TESTDIR", TESTDIR)
     vlog("# Using HGTMP", HGTMP)
     vlog("# Using PATH", os.environ["PATH"])
-    vlog("# Using PYTHONPATH", os.environ["PYTHONPATH"])
+    vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH])
 
     try:
         if len(tests) > 1 and options.jobs > 1: