Patchwork [4,of,7,STABLE] run-tests.py: inherit --pure option from outer run-tests.py execution

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Jan. 21, 2015, 3:10 p.m.
Message ID <4935b1a52e6812c2733a.1421853051@juju>
Download mbox | patch
Permalink /patch/7528/
State Accepted
Commit d64dd12523868a952e82719777d5776fb6c2fa8e
Headers show

Comments

Katsunori FUJIWARA - Jan. 21, 2015, 3:10 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1421852826 -32400
#      Thu Jan 22 00:07:06 2015 +0900
# Branch stable
# Node ID 4935b1a52e6812c2733a541c9ae907456e23e0f6
# Parent  e176f1ffa9a37351e357ea5551595a008c391890
run-tests.py: inherit --pure option from outer run-tests.py execution

Before this patch, "test-run-tests.t" doesn't test "run-tests.py" with
"--pure", even if outer "run-tests.py" is executed with it.

This patch uses not "HG_RUN_TESTS_PURE" but "HGTEST_RUN_TESTS_PURE",
because "HG_" prefixed environments are forcibly dropped in "_getenv()".

This is also useful to run "run-tests.py" successfully by
"run-tests.py --pure" on Windows without any compilation tools (like
VisualStudio).

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1664,6 +1664,9 @@  class TestRunner(object):
             pypath.append(oldpypath)
         os.environ[IMPL_PATH] = os.pathsep.join(pypath)
 
+        if self.options.pure:
+            os.environ["HGTEST_RUN_TESTS_PURE"] = "--pure"
+
         self._coveragefile = os.path.join(self._testdir, '.coverage')
 
         vlog("# Using TESTDIR", self._testdir)
diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -3,7 +3,7 @@  This file tests the behavior of run-test
 Smoke test
 ============
 
-  $ $TESTDIR/run-tests.py
+  $ $TESTDIR/run-tests.py $HGTEST_RUN_TESTS_PURE
   
   # Ran 0 tests, 0 skipped, 0 warned, 0 failed.