[PATCH 2 of 2] tests: replace python dir with $PYTHONDIR in test output

timeless timeless at mozdev.org
Tue Feb 9 15:28:52 EST 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1454078236 0
#      Fri Jan 29 14:37:16 2016 +0000
# Node ID 5b0439bd441ca56cfa0fe0f190406e0140ddd4ce
# Parent  9f2904cf536b2262f9e5b50d9bb6cf35c701f880
tests: replace python dir with $PYTHONDIR in test output

This reduces the number of patterns that must be adjusted when writing tests.
It lets tests not glob away the bindir.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -444,7 +444,8 @@
                  timeout=defaults['timeout'],
                  startport=defaults['port'], extraconfigopts=None,
                  py3kwarnings=False, shell=None,
-                 slowtimeout=defaults['slowtimeout']):
+                 slowtimeout=defaults['slowtimeout'],
+                 pythondir=None):
         """Create a test from parameters.
 
         path is the full path to the file defining the test.
@@ -489,6 +490,7 @@
         self._startport = startport
         self._extraconfigopts = extraconfigopts or []
         self._py3kwarnings = py3kwarnings
+        self._pythondir = pythondir
         self._shell = _bytespath(shell)
 
         self._aborted = False
@@ -725,6 +727,7 @@
              br'\1 (glob)'),
             ]
         r.append((self._escapepath(self._testtmp), b'$TESTTMP'))
+        r.append((self._escapepath(self._pythondir), b'$PYTHONDIR'))
 
         return r
 
@@ -2123,7 +2126,8 @@
                     startport=self._getport(count),
                     extraconfigopts=self.options.extra_config_opt,
                     py3kwarnings=self.options.py3k_warnings,
-                    shell=self.options.shell)
+                    shell=self.options.shell,
+                    pythondir=self._pythondir)
         t.should_reload = True
         return t
 
diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t
--- a/tests/test-devel-warnings.t
+++ b/tests/test-devel-warnings.t
@@ -83,27 +83,27 @@
   $ hg buggylocking --traceback
   devel-warn: transaction with no lock at:
    */hg:* in * (glob)
-   */mercurial/dispatch.py:* in run (glob)
-   */mercurial/dispatch.py:* in dispatch (glob)
-   */mercurial/dispatch.py:* in _runcatch (glob)
-   */mercurial/dispatch.py:* in _dispatch (glob)
-   */mercurial/dispatch.py:* in runcommand (glob)
-   */mercurial/dispatch.py:* in _runcommand (glob)
-   */mercurial/dispatch.py:* in checkargs (glob)
-   */mercurial/dispatch.py:* in <lambda> (glob)
-   */mercurial/util.py:* in check (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in run (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in dispatch (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in _runcatch (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in _dispatch (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in runcommand (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in _runcommand (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in checkargs (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in <lambda> (glob)
+   $PYTHONDIR/mercurial/util.py:* in check (glob)
    $TESTTMP/buggylocking.py:* in buggylocking (glob)
   devel-warn: "wlock" acquired after "lock" at:
    */hg:* in * (glob)
-   */mercurial/dispatch.py:* in run (glob)
-   */mercurial/dispatch.py:* in dispatch (glob)
-   */mercurial/dispatch.py:* in _runcatch (glob)
-   */mercurial/dispatch.py:* in _dispatch (glob)
-   */mercurial/dispatch.py:* in runcommand (glob)
-   */mercurial/dispatch.py:* in _runcommand (glob)
-   */mercurial/dispatch.py:* in checkargs (glob)
-   */mercurial/dispatch.py:* in <lambda> (glob)
-   */mercurial/util.py:* in check (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in run (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in dispatch (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in _runcatch (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in _dispatch (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in runcommand (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in _runcommand (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in checkargs (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in <lambda> (glob)
+   $PYTHONDIR/mercurial/util.py:* in check (glob)
    $TESTTMP/buggylocking.py:* in buggylocking (glob)
   $ hg properlocking
   $ hg nowaitlocking
@@ -118,7 +118,7 @@
   [255]
 
   $ hg log -r "oldstyle()" -T '{rev}\n'
-  devel-warn: revset "oldstyle" use list instead of smartset, (upgrade your code) at: */mercurial/revset.py:* (mfunc) (glob)
+  devel-warn: revset "oldstyle" use list instead of smartset, (upgrade your code) at: $PYTHONDIR/mercurial/revset.py:* (mfunc) (glob)
   0
   $ hg oldanddeprecated
   devel-warn: foorbar is deprecated, go shopping
@@ -128,14 +128,14 @@
   devel-warn: foorbar is deprecated, go shopping
   (compatibility will be dropped after Mercurial-42.1337, update your code.) at:
    */hg:* in <module> (glob)
-   */mercurial/dispatch.py:* in run (glob)
-   */mercurial/dispatch.py:* in dispatch (glob)
-   */mercurial/dispatch.py:* in _runcatch (glob)
-   */mercurial/dispatch.py:* in _dispatch (glob)
-   */mercurial/dispatch.py:* in runcommand (glob)
-   */mercurial/dispatch.py:* in _runcommand (glob)
-   */mercurial/dispatch.py:* in checkargs (glob)
-   */mercurial/dispatch.py:* in <lambda> (glob)
-   */mercurial/util.py:* in check (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in run (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in dispatch (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in _runcatch (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in _dispatch (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in runcommand (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in _runcommand (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in checkargs (glob)
+   $PYTHONDIR/mercurial/dispatch.py:* in <lambda> (glob)
+   $PYTHONDIR/mercurial/util.py:* in check (glob)
    $TESTTMP/buggylocking.py:* in oldanddeprecated (glob)
   $ cd ..


More information about the Mercurial-devel mailing list