You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2014/05/07 15:40:01 UTC

svn commit: r1593014 - /subversion/trunk/tools/dist/backport_tests.py

Author: danielsh
Date: Wed May  7 13:40:00 2014
New Revision: 1593014

URL: http://svn.apache.org/r1593014
Log:
Follow-up to r1592987: unbreak backport_tests.py.

With this change, all of the following cases will work:

- run tests with cwd=(subversion/tests/cmdline/ subdir of an out-of-tree build)
- run tests in-tree
- run backport_tests.py

* tools/dist/backport_tests.py
  (chdir): Define earlier in the file.
  (sys.path): Convert the inserted value to abspath.
  (svntest): Change cwd while importing (like win-tests.py does), document
    the reason.

Modified:
    subversion/trunk/tools/dist/backport_tests.py

Modified: subversion/trunk/tools/dist/backport_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport_tests.py?rev=1593014&r1=1593013&r2=1593014&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport_tests.py (original)
+++ subversion/trunk/tools/dist/backport_tests.py Wed May  7 13:40:00 2014
@@ -32,9 +32,20 @@ import os
 import re
 import sys
 
+@contextlib.contextmanager
+def chdir(dir):
+  try:
+    saved_dir = os.getcwd()
+    os.chdir(dir)
+    yield
+  finally:
+    os.chdir(saved_dir)
+
 # Our testing module
-sys.path.insert(0, '../../subversion/tests/cmdline')
-import svntest
+# HACK: chdir to cause svntest.main.svn_binary to be set correctly
+sys.path.insert(0, os.path.abspath('../../subversion/tests/cmdline'))
+with chdir('../../subversion/tests/cmdline'):
+  import svntest
 
 # (abbreviations)
 Skip = svntest.testcase.Skip_deco
@@ -51,15 +62,6 @@ BACKPORT_PL = os.path.abspath(os.path.jo
                                            'backport.pl'))
 STATUS = 'branch/STATUS'
 
-@contextlib.contextmanager
-def chdir(dir):
-  try:
-    saved_dir = os.getcwd()
-    os.chdir(dir)
-    yield
-  finally:
-    os.chdir(saved_dir)
-
 class BackportTest(object):
   """Decorator.  See self.__call__()."""