Would this be helpful?

(see the patch in the attachments)

-- 
Timofei Zhakov
Index: build/run_tests.py
===================================================================
--- build/run_tests.py  (revision 1925818)
+++ build/run_tests.py  (working copy)
@@ -315,6 +315,8 @@
       cmdline.append('--valgrind=%s' % self.opts.valgrind)
     if self.opts.valgrind_opts is not None:
       cmdline.append('--valgrind-opts=%s' % self.opts.valgrind_opts)
+    if self.opts.verify_xml_schemas:
+      cmdline.append('--verify-xml-schemas')
 
     self.py_test_cmdline = cmdline
 
@@ -326,16 +328,8 @@
 
       global svntest
       svntest = importlib.import_module('svntest')
-      extra_packages = svntest.main.ensure_dependencies()
       svntest.main.parse_options(cmdline, optparse.SUPPRESS_USAGE)
       svntest.testcase.TextColors.disable()
-
-      # We have to update PYTHONPATH, otherwise the whole setting up of a
-      # virtualenv and installing dependencies will happen for every test case.
-      python_path = os.environ.get("PYTHONPATH")
-      python_path = (extra_packages if not python_path
-                     else "%s:%s" % (extra_packages, python_path))
-      os.environ["PYTHONPATH"] = python_path
     finally:
       os.chdir(old_cwd)
 
@@ -1091,6 +1085,8 @@
                     help='programs to run under valgrind')
   parser.add_option('--valgrind-opts', action='store',
                     help='options to pass valgrind')
+  parser.add_option('--verify-xml-schemas', action='store_true',
+                    help='test Relax NG shemas (requrires lxml)')
 
   parser.set_defaults(set_log_level=None)
   return parser
Index: subversion/tests/cmdline/svntest/actions.py
===================================================================
--- subversion/tests/cmdline/svntest/actions.py (revision 1925818)
+++ subversion/tests/cmdline/svntest/actions.py (working copy)
@@ -331,7 +331,7 @@
   and validates it against the schema for the given command"""
   exit_code, out, err = run_and_verify_svn(expected_stdout, expected_stderr,
                                            command, *varargs)
-  if exit_code == 0:
+  if exit_code == 0 and svntest.main.options.verify_xml_schemas:
     verify.validate_xml_schema(command, out)
   return exit_code, out, err
 
@@ -355,7 +355,7 @@
   and validates it against the schema for the given command"""
   exit_code, out, err = run_and_verify_svn2(expected_stdout, expected_stderr,
                                             expected_exit, command, *varargs)
-  if exit_code == 0:
+  if exit_code == 0 and svntest.main.options.verify_xml_schemas:
     verify.validate_xml_schema(command, out)
   return exit_code, out, err
 
Index: subversion/tests/cmdline/svntest/main.py
===================================================================
--- subversion/tests/cmdline/svntest/main.py    (revision 1925818)
+++ subversion/tests/cmdline/svntest/main.py    (working copy)
@@ -39,7 +39,6 @@
 import zipfile
 import codecs
 import queue
-import venv
 
 from urllib.parse import quote as urllib_parse_quote
 from urllib.parse import unquote as urllib_parse_unquote
@@ -120,13 +119,11 @@
 if sys.platform == 'win32':
   windows = True
   file_scheme_prefix = 'file:///'
-  venv_bin = 'Scripts'
   _exe = '.exe'
   _bat = '.bat'
   os.environ['SVN_DBG_STACKTRACES_TO_STDERR'] = 'y'
 else:
   windows = False
-  venv_bin = 'bin'
   file_scheme_prefix = 'file://'
   _exe = ''
   _bat = ''
@@ -173,7 +170,7 @@
 def P(relpath,
       head=os.path.dirname(os.path.dirname(os.path.abspath('.')))
       ):
-  if windows:
+  if sys.platform=='win32':
     return os.path.join(head, relpath + '.exe')
   else:
     return os.path.join(head, relpath)
@@ -220,14 +217,6 @@
 # this dir, so there's one point at which to mount, e.g., a ramdisk.
 work_dir = "svn-test-work"
 
-# Directory for the Python virtual environment where we install
-# external dependencies of the test environment
-venv_dir = os.path.join(work_dir, "__venv__")
-
-# List of dependencies
-SVN_TESTS_REQUIRE = ["lxml", "rnc2rng"]
-dependencies_ensured = False
-
 # Constant for the merge info property.
 SVN_PROP_MERGEINFO = "svn:mergeinfo"
 
@@ -870,7 +859,7 @@
   exit_code, stdout_lines, stderr_lines = \
                        run_command(svnadmin_binary, 1, use_binary, *varargs)
 
-  if use_binary and windows:
+  if use_binary and sys.platform == 'win32':
     # Callers don't expect binary output on stderr
     stderr_lines = [x.replace('\r', '') for x in stderr_lines]
 
@@ -1862,6 +1851,8 @@
       args.append('--valgrind=' + options.valgrind)
     if options.valgrind_opts:
       args.append('--valgrind-opts=' + options.valgrind_opts)
+    if options.verify_xml_schemas:
+      args.append('--verify-xml-schemas')
 
     result, stdout_lines, stderr_lines = spawn_process(command, 0, False, None,
                                                        *args)
@@ -2306,6 +2297,8 @@
                     help='programs to run under valgrind')
   parser.add_option('--valgrind-opts', action='store',
                     help='options to pass to valgrind')
+  parser.add_option('--verify-xml-schemas', action='store_true',
+                    help='test Relax NG shemas (requrires lxml)')
 
   # most of the defaults are None, but some are other values, set them here
   parser.set_defaults(
@@ -2417,50 +2410,8 @@
         appropriate exit code.
   """
 
-  ensure_dependencies()
   sys.exit(execute_tests(test_list, serial_only))
 
-def ensure_dependencies():
-  """Install the dependencies we need for running the tests.
-
-  NOTE: this function des not handle the case where the Python
-        version has changed. In theory, we could automagically
-        upgrade the venv in that case. In practice, we won't.
-  """
-
-  global dependencies_ensured
-  if dependencies_ensured:
-    return
-
-  package_path = os.path.join(venv_dir, "lib",
-                              "python%d.%d" % sys.version_info[:2],
-                              "site-packages")
-  package_path = os.path.abspath(package_path)
-  if package_path in sys.path:
-    dependencies_ensured = True
-    return
-
-  try:
-    # Create the virtual environment
-    if not os.path.isdir(venv_dir):
-      if os.path.exists(venv_dir):
-        safe_rmtree(venv_dir)
-      venv.create(venv_dir, with_pip=True)
-
-    # Install any (new) dependencies
-    pip = os.path.join(venv_dir, venv_bin, "pip"+_exe)
-    pip_options = ("--disable-pip-version-check", "--require-virtualenv")
-    subprocess.run([pip, *pip_options, "install", *SVN_TESTS_REQUIRE],
-                   check=True)
-
-    sys.path.append(package_path)
-    dependencies_ensured = True
-    return package_path
-  except Exception as ex:
-    print("WARNING: Could not install test dependencies,"
-          " some tests will be skipped", file=sys.stderr)
-    print(ex, file=sys.stderr)
-
 def get_issue_details(issue_numbers):
   """For each issue number in ISSUE_NUMBERS query the issue
      tracker and determine what the target milestone is and

Reply via email to