Author: kotkov
Date: Wed Nov 23 09:56:17 2022
New Revision: 1905472

URL: http://svn.apache.org/viewvc?rev=1905472&view=rev
Log:
In the Python test suite, avoid having to hand-craft the expected output
of "svn revert" by using the run_and_verify_revert() test action.

* subversion/tests/cmdline/depth_tests.py
  (revert_depth_files): Use run_and_verify_revert().

* subversion/tests/cmdline/merge_tests.py
  (merge_to_switched_path,
   dont_add_mergeinfo_from_own_history): Use run_and_verify_revert().

* subversion/tests/cmdline/patch_tests.py
  (patch_no_svn_eol_style,
   patch_with_svn_eol_style,
   patch_with_svn_eol_style_uncommitted): Use run_and_verify_revert().

* subversion/tests/cmdline/schedule_tests.py
  (check_reversion): Remove.
  (revert_add_files,
   revert_add_directories,
   revert_nested_adds,
   revert_add_executable,
   revert_delete_files,
   revert_delete_dirs): Use run_and_verify_revert().

Modified:
    subversion/trunk/subversion/tests/cmdline/depth_tests.py
    subversion/trunk/subversion/tests/cmdline/merge_tests.py
    subversion/trunk/subversion/tests/cmdline/patch_tests.py
    subversion/trunk/subversion/tests/cmdline/schedule_tests.py

Modified: subversion/trunk/subversion/tests/cmdline/depth_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/depth_tests.py?rev=1905472&r1=1905471&r2=1905472&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/depth_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/depth_tests.py Wed Nov 23 
09:56:17 2022
@@ -2781,23 +2781,21 @@ def revert_depth_files(sbox):
 
   sbox.build(read_only = True)
 
-  expected_output = "Reverted '" + re.escape(sbox.ospath('A/mu')) + "'"
-
   # Apply an unrelated delete one level to deep
   sbox.simple_rm('A/D/gamma')
 
   sbox.simple_rm('A/mu')
   # Expect reversion of just 'mu'
-  svntest.actions.run_and_verify_svn(expected_output, [],
-                                     'revert', '--depth=immediates', 
sbox.ospath('A'))
+  svntest.actions.run_and_verify_revert([sbox.ospath('A/mu')],
+                                        '--depth=immediates', sbox.ospath('A'))
 
   # Apply an unrelated directory delete
   sbox.simple_rm('A/D')
 
   sbox.simple_rm('A/mu')
   # Expect reversion of just 'mu'
-  svntest.actions.run_and_verify_svn(expected_output, [],
-                                     'revert', '--depth=files', 
sbox.ospath('A'))
+  svntest.actions.run_and_verify_revert([sbox.ospath('A/mu')],
+                                        '--depth=files', sbox.ospath('A'))
 
 @Issue(4257)
 def spurious_nodes_row(sbox):

Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=1905472&r1=1905471&r2=1905472&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Wed Nov 23 
09:56:17 2022
@@ -5067,11 +5067,10 @@ def merge_to_switched_path(sbox):
   # but as it is switched this empty mergeinfo just elides to the
   # repository (empty mergeinfo on a path can elide if that path doesn't
   # inherit *any* mergeinfo).
-  svntest.actions.run_and_verify_svn(["Reverted '" + A_COPY_path+ "'\n",
-                                      "Reverted '" + A_COPY_D_G_path+ "'\n",
-                                      "Reverted '" + A_COPY_D_G_rho_path +
-                                      "'\n"],
-                                     [], 'revert', '-R', wc_dir)
+  svntest.actions.run_and_verify_revert([A_COPY_path,
+                                         A_COPY_D_G_path,
+                                         A_COPY_D_G_rho_path],
+                                        '-R', wc_dir)
   svntest.actions.run_and_verify_svn(["property '" + SVN_PROP_MERGEINFO +
                                       "' set on '" + A_COPY_D_path+ "'" +
                                       "\n"], [], 'ps', SVN_PROP_MERGEINFO,
@@ -9635,9 +9634,9 @@ def dont_add_mergeinfo_from_own_history(
                                        '--allow-mixed-revisions', A_path)
 
   # Revert all local mods
-  svntest.actions.run_and_verify_svn(["Reverted '" + A_path + "'\n",
-                                      "Reverted '" + mu_path + "'\n"],
-                                     [], 'revert', '-R', wc_dir)
+  svntest.actions.run_and_verify_revert([A_path,
+                                         mu_path],
+                                        '-R', wc_dir)
 
   # Move 'A' to 'A_MOVED' and once again merge r7 from 'A_COPY', this time
   # to 'A_MOVED'.  This attempts to add the mergeinfo '/A:3' to
@@ -9772,9 +9771,9 @@ def dont_add_mergeinfo_from_own_history(
                                        check_props=True)
 
   # Revert all local mods
-  svntest.actions.run_and_verify_svn(["Reverted '" + A_MOVED_path + "'\n",
-                                      "Reverted '" + mu_MOVED_path + "'\n"],
-                                     [], 'revert', '-R', wc_dir)
+  svntest.actions.run_and_verify_revert([A_MOVED_path,
+                                         mu_MOVED_path],
+                                        '-R', wc_dir)
 
   # Create a new 'A' unrelated to the old 'A' which was moved.  Then merge
   # r7 from 'A_COPY' to this new 'A'.  Since the new 'A' shares no history

Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=1905472&r1=1905471&r2=1905472&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Wed Nov 23 
09:56:17 2022
@@ -1662,9 +1662,8 @@ def patch_no_svn_eol_style(sbox):
                                             [], True, True,
                                             keep_eol_style=True)
 
-      expected_output = ["Reverted '" + mu_path + "'\n"]
-      svntest.actions.run_and_verify_svn(expected_output, [],
-                                         'revert', '-R', wc_dir)
+      svntest.actions.run_and_verify_revert([mu_path],
+                                            '-R', wc_dir)
 
 def patch_with_svn_eol_style(sbox):
   "patch target with svn:eol-style"
@@ -1779,8 +1778,8 @@ def patch_with_svn_eol_style(sbox):
                                             1, # dry-run
                                             keep_eol_style=True)
 
-      expected_output = ["Reverted '" + mu_path + "'\n"]
-      svntest.actions.run_and_verify_svn(expected_output, [], 'revert', '-R', 
wc_dir)
+      svntest.actions.run_and_verify_revert([mu_path],
+                                            '-R', wc_dir)
 
 def patch_with_svn_eol_style_uncommitted(sbox):
   "patch target with uncommitted svn:eol-style"
@@ -1889,8 +1888,8 @@ def patch_with_svn_eol_style_uncommitted
                                             1, # dry-run
                                             keep_eol_style=True)
 
-      expected_output = ["Reverted '" + mu_path + "'\n"]
-      svntest.actions.run_and_verify_svn(expected_output, [], 'revert', '-R', 
wc_dir)
+      svntest.actions.run_and_verify_revert([mu_path],
+                                            '-R', wc_dir)
 
 def patch_with_ignore_whitespace(sbox):
   "ignore whitespace when patching"

Modified: subversion/trunk/subversion/tests/cmdline/schedule_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/schedule_tests.py?rev=1905472&r1=1905471&r2=1905472&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/schedule_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/schedule_tests.py Wed Nov 23 
09:56:17 2022
@@ -253,19 +253,6 @@ def delete_dirs(sbox):
 #  and then also tests reversion of those changes.
 #
 
-def check_reversion(files, output):
-  expected_output = []
-  for file in files:
-    expected_output = expected_output + ["Reverted '" + file + "'\n"]
-  output.sort()
-  expected_output.sort()
-  if output != expected_output:
-    logger.warn("Expected output: %s", expected_output)
-    logger.warn("Actual output:   %s", output)
-    raise svntest.Failure
-
-#----------------------------------------------------------------------
-
 def revert_add_files(sbox):
   "revert: add some files"
 
@@ -278,11 +265,7 @@ def revert_add_files(sbox):
   epsilon_path = sbox.ospath('A/D/G/epsilon')
   files = [delta_path, zeta_path, epsilon_path]
 
-  exit_code, output, err = svntest.actions.run_and_verify_svn(None, [],
-                                                              'revert',
-                                                              '--recursive',
-                                                              wc_dir)
-  check_reversion(files, output)
+  svntest.actions.run_and_verify_revert(files, '--recursive', wc_dir)
 
 #----------------------------------------------------------------------
 
@@ -298,11 +281,7 @@ def revert_add_directories(sbox):
   Z_path = sbox.ospath('A/D/H/Z')
   files = [X_path, Y_path, Z_path]
 
-  exit_code, output, err = svntest.actions.run_and_verify_svn(None, [],
-                                                              'revert',
-                                                              '--recursive',
-                                                              wc_dir)
-  check_reversion(files, output)
+  svntest.actions.run_and_verify_revert(files, '--recursive', wc_dir)
 
 #----------------------------------------------------------------------
 
@@ -324,11 +303,7 @@ def revert_nested_adds(sbox):
            + [os.path.join(Z_path, child)
               for child in ['R', 'zeta']])
 
-  exit_code, output, err = svntest.actions.run_and_verify_svn(None, [],
-                                                              'revert',
-                                                              '--recursive',
-                                                              wc_dir)
-  check_reversion(files, output)
+  svntest.actions.run_and_verify_revert(files, '--recursive', wc_dir)
 
 #----------------------------------------------------------------------
 @SkipUnless(svntest.main.is_posix_os)
@@ -345,11 +320,7 @@ def revert_add_executable(sbox):
   other_path = sbox.ospath('other_exe')
   files = [all_path, none_path, user_path, group_path, other_path]
 
-  exit_code, output, err = svntest.actions.run_and_verify_svn(None, [],
-                                                              'revert',
-                                                              '--recursive',
-                                                              wc_dir)
-  check_reversion(files, output)
+  svntest.actions.run_and_verify_revert(files, '--recursive', wc_dir)
 
 #----------------------------------------------------------------------
 
@@ -366,11 +337,7 @@ def revert_delete_files(sbox):
   omega_path = sbox.ospath('A/D/H/omega')
   files = [iota_path, mu_path, omega_path, rho_path]
 
-  exit_code, output, err = svntest.actions.run_and_verify_svn(None, [],
-                                                              'revert',
-                                                              '--recursive',
-                                                              wc_dir)
-  check_reversion(files, output)
+  svntest.actions.run_and_verify_revert(files, '--recursive', wc_dir)
 
 #----------------------------------------------------------------------
 
@@ -392,11 +359,7 @@ def revert_delete_dirs(sbox):
   files = [E_path, F_path, H_path,
            alpha_path, beta_path, chi_path, omega_path, psi_path]
 
-  exit_code, output, err = svntest.actions.run_and_verify_svn(None, [],
-                                                              'revert',
-                                                              '--recursive',
-                                                              wc_dir)
-  check_reversion(files, output)
+  svntest.actions.run_and_verify_revert(files, '--recursive', wc_dir)
 
 
 #######################################################################


Reply via email to