[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Continued test-suite cleanup: schedule tests (part 1)

From: <wiskid_at_gmx.net>
Date: 2003-09-07 12:13:41 CEST

Ok, to get the conversation back onto the list, Fitz no I don't mind
supplying the patches separate. The attached patch converts schedule_tests.py to the
new exception based system. In a separate (yet to send) message + patch I
will put the conversion from make_repos_and_wc to sbox.build.

The log message for this one:

[[[
Part of the grand "return 0/1 to exception based error handling"
test suite rewrite.

* subversion/tests/clients/cmdline/schedule_tests.py

]]]

--- subversion/tests/clients/cmdline-old/schedule_tests.py 2003-09-07
12:00:11.000000000 +0200
+++ subversion/tests/clients/cmdline/schedule_tests.py 2003-09-07
11:27:49.000000000 +0200
@@ -66,8 +66,7 @@
 
   wc_dir = sbox.wc_dir
 
- if svntest.actions.make_repo_and_wc(sbox):
- return 1
+ svntest.actions.make_repo_and_wc(sbox)
 
   # Create some files, then schedule them for addition
   delta_path = os.path.join(wc_dir, 'delta')
@@ -88,7 +87,7 @@
     'A/D/G/epsilon' : Item(status='A ', wc_rev=0, repos_rev=1),
     })
 
- return svntest.actions.run_and_verify_status(wc_dir, expected_status)
+ svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 #----------------------------------------------------------------------
 
@@ -97,8 +96,7 @@
 
   wc_dir = sbox.wc_dir
 
- if svntest.actions.make_repo_and_wc(sbox):
- return 1
+ svntest.actions.make_repo_and_wc(sbox)
 
   # Create some directories, then schedule them for addition
   X_path = os.path.join(wc_dir, 'X')
@@ -119,7 +117,7 @@
     'A/D/H/Z' : Item(status='A ', wc_rev=0, repos_rev=1),
     })
 
- return svntest.actions.run_and_verify_status(wc_dir, expected_status)
+ svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 #----------------------------------------------------------------------
 
@@ -128,8 +126,7 @@
 
   wc_dir = sbox.wc_dir
 
- if svntest.actions.make_repo_and_wc(sbox):
- return 1
+ svntest.actions.make_repo_and_wc(sbox)
 
   # Create some directories then schedule them for addition
   X_path = os.path.join(wc_dir, 'X')
@@ -178,27 +175,28 @@
     'A/D/H/Z/zeta' : Item(status='A ', wc_rev=0, repos_rev=1),
     })
 
- return svntest.actions.run_and_verify_status(wc_dir, expected_status)
+ svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 #----------------------------------------------------------------------
 
 def add_executable(sbox):
   "schedule: add some executable files"
 
- if sbox.build():
- return 1
+ sbox.build()
+
   def runTest(wc_dir, fileName, perm, executable):
     fileName = os.path.join(wc_dir, fileName)
     if executable:
- expected = (["*\n"], [])
+ expected_out = ["*\n"]
     else:
- expected = ([], [])
+ expected_out = []
     f = open(fileName,"w")
     f.close()
     os.chmod(fileName,perm)
     svntest.main.run_svn(None, 'add', fileName)
- return expected != svntest.main.run_svn(None, 'propget',
- "svn:executable", fileName)
+ svntest.actions.run_and_verify_svn(None, expected_out, [],
+ 'propget', "svn:executable",
fileName)
+
   test_cases = [
     ("all_exe", 0777, 1),
     ("none_exe", 0666, 0),
@@ -207,8 +205,7 @@
     ("other_exe", 0667, 0),
     ]
   for test_case in test_cases:
- if runTest(sbox.wc_dir, *test_case):
- return 1
+ runTest(sbox.wc_dir, *test_case)
 
 #----------------------------------------------------------------------
 
@@ -217,8 +214,7 @@
 
   wc_dir = sbox.wc_dir
 
- if svntest.actions.make_repo_and_wc(sbox):
- return 1
+ svntest.actions.make_repo_and_wc(sbox)
 
   # Schedule some files for deletion
   iota_path = os.path.join(wc_dir, 'iota')
@@ -233,7 +229,7 @@
   expected_status.tweak('iota', 'A/mu', 'A/D/G/rho', 'A/D/H/omega',
                         status='D ')
 
- return svntest.actions.run_and_verify_status(wc_dir, expected_status)
+ svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 #----------------------------------------------------------------------
 
@@ -242,8 +238,7 @@
 
   wc_dir = sbox.wc_dir
 
- if svntest.actions.make_repo_and_wc(sbox):
- return 1
+ svntest.actions.make_repo_and_wc(sbox)
 
   # Schedule some directories for deletion (this is recursive!)
   E_path = os.path.join(wc_dir, 'A', 'B', 'E')
@@ -265,7 +260,7 @@
                         'A/D/H', 'A/D/H/chi', 'A/D/H/omega', 'A/D/H/psi',
                         status='D ')
 
- return svntest.actions.run_and_verify_status(wc_dir, expected_status)
+ svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 
 #######################################################################
@@ -275,11 +270,9 @@
 def revert_add_files(sbox):
   "revert: add some files"
 
+ add_files(sbox)
   wc_dir = sbox.wc_dir
 
- if add_files(sbox):
- return 1
-
   # Revert our changes recursively from wc_dir.
   delta_path = os.path.join(wc_dir, 'delta')
   zeta_path = os.path.join(wc_dir, 'A', 'B', 'zeta')
@@ -287,32 +280,25 @@
   expected_output = ["Reverted " + delta_path + "\n",
                      "Reverted " + zeta_path + "\n",
                      "Reverted " + epsilon_path + "\n"]
- output, errput = svntest.main.run_svn (None, 'revert', '--recursive',
wc_dir)
-
- # Make sure we got the right output.
- if len(errput) > 0:
- print errput
- return 1
+ output, err = svntest.actions.run_and_verify_svn(None, None, [],
+ 'revert',
+ '--recursive', wc_dir)
 
   ### do we really need to sort these?
- output = _tweak_paths(output) # FIXME: see commend at _tweak_paths
+ output = _tweak_paths(output) # FIXME: see comment at _tweak_paths
   output.sort()
   expected_output.sort()
   if output != expected_output:
- return 1
-
- return 0
+ raise svntest.Failure
 
 #----------------------------------------------------------------------
 
 def revert_add_directories(sbox):
   "revert: add some directories"
 
+ add_directories(sbox)
   wc_dir = sbox.wc_dir
 
- if add_directories(sbox):
- return 1
-
   # Revert our changes recursively from wc_dir.
   X_path = os.path.join(wc_dir, 'X')
   Y_path = os.path.join(wc_dir, 'A', 'C', 'Y')
@@ -320,32 +306,25 @@
   expected_output = ["Reverted " + X_path + "\n",
                      "Reverted " + Y_path + "\n",
                      "Reverted " + Z_path + "\n"]
- output, errput = svntest.main.run_svn (None, 'revert', '--recursive',
wc_dir)
-
- # Make sure we got the right output.
- if len(errput) > 0:
- print errput
- return 1
+ output, err = svntest.actions.run_and_verify_svn(None, None, [],
+ 'revert',
+ '--recursive', wc_dir)
 
   ### do we really need to sort these?
   output = _tweak_paths(output) # FIXME: see commend at _tweak_paths
   output.sort()
   expected_output.sort()
   if output != expected_output:
- return 1
-
- return 0
+ raise svntest.Failure
 
 #----------------------------------------------------------------------
 
 def revert_nested_adds(sbox):
   "revert: add some nested files and directories"
 
+ nested_adds(sbox)
   wc_dir = sbox.wc_dir
 
- if nested_adds(sbox):
- return 1
-
   # Revert our changes recursively from wc_dir.
   X_path = os.path.join(wc_dir, 'X')
   Y_path = os.path.join(wc_dir, 'A', 'C', 'Y')
@@ -353,31 +332,24 @@
   expected_output = ["Reverted " + X_path + "\n",
                      "Reverted " + Y_path + "\n",
                      "Reverted " + Z_path + "\n"]
- output, errput = svntest.main.run_svn (None, 'revert', '--recursive',
wc_dir)
-
- # Make sure we got the right output.
- if len(errput) > 0:
- print errput
- return 1
-
+ output, err = svntest.actions.run_and_verify_svn(None, None, [],
+ 'revert',
+ '--recursive', wc_dir)
   ### do we really need to sort these?
   output = _tweak_paths(output) # FIXME: see commend at _tweak_paths
   output.sort()
   expected_output.sort()
   if output != expected_output:
- return 1
-
- return 0
-
+ raise svntest.Failure
+
 #----------------------------------------------------------------------
 
 def revert_add_executable(sbox):
   "revert: add some executable files"
 
- if add_executable(sbox):
- return 1
-
+ add_executable(sbox)
   wc_dir = sbox.wc_dir
+
   all_path = os.path.join(wc_dir, 'all_exe')
   none_path = os.path.join(wc_dir, 'none_exe')
   user_path = os.path.join(wc_dir, 'user_exe')
@@ -390,33 +362,25 @@
                      "Reverted " + group_path + "\n",
                      "Reverted " + other_path + "\n"]
 
- output, errput = svntest.main.run_svn (None, 'revert',
- '--recursive', wc_dir)
-
- # Make sure we got the right output.
- if len(errput) > 0:
- print errput
- return 1
+ output, err = svntest.actions.run_and_verify_svn(None, None, [],
+ 'revert',
+ '--recursive', wc_dir)
 
   ### do we really need to sort these?
- output = _tweak_paths(output) # FIXME: see commend at _tweak_paths
+ expected_output = _tweak_paths(expected_output)
   output.sort()
   expected_output.sort()
   if output != expected_output:
- return 1
-
- return 0
+ raise svntest.Failure
 
 #----------------------------------------------------------------------
 
 def revert_delete_files(sbox):
   "revert: delete some files"
 
+ delete_files(sbox)
   wc_dir = sbox.wc_dir
 
- if delete_files(sbox):
- return 1
-
   # Revert our changes recursively from wc_dir.
   iota_path = os.path.join(wc_dir, 'iota')
   mu_path = os.path.join(wc_dir, 'A', 'mu')
@@ -426,32 +390,24 @@
                      "Reverted " + mu_path + "\n",
                      "Reverted " + omega_path + "\n",
                      "Reverted " + rho_path + "\n"]
- output, errput = svntest.main.run_svn (None, 'revert', '--recursive',
wc_dir)
-
- # Make sure we got the right output.
- if len(errput) > 0:
- print errput
- return 1
-
+ output, err = svntest.actions.run_and_verify_svn(None, None, [],
+ 'revert',
+ '--recursive', wc_dir)
   ### do we really need to sort these?
   output = _tweak_paths(output) # FIXME: see commend at _tweak_paths
   output.sort()
   expected_output.sort()
   if output != expected_output:
- return 1
-
- return 0
+ raise svntest.Failure
 
 #----------------------------------------------------------------------
 
 def revert_delete_dirs(sbox):
   "revert: delete some directories"
 
+ delete_dirs(sbox)
   wc_dir = sbox.wc_dir
 
- if delete_dirs(sbox):
- return 1
-
   # Revert our changes recursively from wc_dir.
   E_path = os.path.join(wc_dir, 'A', 'B', 'E')
   F_path = os.path.join(wc_dir, 'A', 'B', 'F')
@@ -469,22 +425,15 @@
                      "Reverted " + chi_path + "\n",
                      "Reverted " + omega_path + "\n",
                      "Reverted " + psi_path + "\n"]
- output, errput = svntest.main.run_svn (None, 'revert', '--recursive',
wc_dir)
-
- # Make sure we got the right output.
- if len(errput) > 0:
- print errput
- return 1
-
+ output, err = svntest.actions.run_and_verify_svn(None, None, [],
+ 'revert',
+ '--recursive', wc_dir)
   ### do we really need to sort these?
   output = _tweak_paths(output) # FIXME: see commend at _tweak_paths
   output.sort()
   expected_output.sort()
   if output != expected_output:
- return 1
-
- return 0
-
+ raise svntest.Failure
 
 #######################################################################
 # Stage III - Commit of modifications made in Stage 1
@@ -493,66 +442,55 @@
 def commit_add_files(sbox):
   "commit: add some files"
 
- if add_files(sbox):
- return 1
+ add_files(sbox)
 
- return 1
- return 0
+ raise svntest.Failure
 
 #----------------------------------------------------------------------
 
 def commit_add_directories(sbox):
   "commit: add some directories"
 
- if add_directories(sbox):
- return 1
+ add_directories(sbox)
 
- return 1
- return 0
+ raise svntest.Failure
 
 #----------------------------------------------------------------------
 
 def commit_nested_adds(sbox):
   "commit: add some nested files and directories"
 
- if nested_adds(sbox):
- return 1
+ nested_adds(sbox)
 
- return 1
- return 0
+ raise svntest.Failure
 
 #----------------------------------------------------------------------
 
 def commit_add_executable(sbox):
   "commit: add some executable files"
 
- if add_executable(sbox):
- return 1
+ add_executable(sbox)
+
+ raise svntest.Failure
 
- return 1
- return 0
 
 #----------------------------------------------------------------------
 
 def commit_delete_files(sbox):
   "commit: delete some files"
 
- if delete_files(sbox):
- return 1
+ delete_files(sbox)
 
- return 1
- return 0
+ raise svntest.Failure
 
 #----------------------------------------------------------------------
 
 def commit_delete_dirs(sbox):
   "commit: delete some directories"
 
- if delete_dirs(sbox):
- return 1
+ delete_dirs(sbox)
 
- return 1
- return 0
+ raise svntest.Failure
 
 #----------------------------------------------------------------------
 # Regression test for issue #863:
@@ -568,8 +506,7 @@
 
   wc_dir = sbox.wc_dir
 
- if svntest.actions.make_repo_and_wc(sbox):
- return 1
+ svntest.actions.make_repo_and_wc(sbox)
 
   # Create some files and dirs, then schedule them for addition
   file1_path = os.path.join(wc_dir, 'file1')
@@ -591,8 +528,7 @@
     'dir2' : Item(status='A ', wc_rev=0, repos_rev=1),
     })
 
- if svntest.actions.run_and_verify_status(wc_dir, expected_status):
- return 1
+ svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
   # Poof, all 4 added things are now missing in action.
   os.remove(file1_path)
@@ -606,10 +542,7 @@
 
   # 'svn st' should now show absolutely zero local mods.
   expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
- if svntest.actions.run_and_verify_status(wc_dir, expected_status):
- return 1
-
- return 0
+ svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
 #----------------------------------------------------------------------
 # Regression test for issue #962:
@@ -622,8 +555,7 @@
 
   wc_dir = sbox.wc_dir
 
- if svntest.actions.make_repo_and_wc(sbox):
- return 1
+ svntest.actions.make_repo_and_wc(sbox)
 
   mu_path = os.path.join(wc_dir, 'A', 'mu')
   H_path = os.path.join(wc_dir, 'A', 'D', 'H')
@@ -633,9 +565,7 @@
   svntest.main.safe_rmtree(H_path)
 
   # Now schedule them for deletion anyway, and make sure no error is
output.
- stdout, stderr = svntest.main.run_svn(None, 'rm', mu_path, H_path)
- if len(stderr) != 0:
- return 1
+ svntest.actions.run_and_verify_svn(None, None, [], 'rm', mu_path, H_path)
 
   # Commit the deletions.
   expected_output = svntest.wc.State(wc_dir, {
@@ -648,11 +578,11 @@
                          'A/D/H/psi', 'A/D/H/omega', 'A/D/H/chi')
   expected_status.tweak(wc_rev=1)
 
- return svntest.actions.run_and_verify_commit (wc_dir,
- expected_output,
- expected_status,
- None, None, None, None,
None,
- wc_dir)
+ svntest.actions.run_and_verify_commit(wc_dir,
+ expected_output,
+ expected_status,
+ None, None, None, None, None,
+ wc_dir)
 
 #----------------------------------------------------------------------
 # Regression test for issue #854:

-- 
COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
--------------------------------------------------
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. web.de - 5. T-Online - 6. freenet.de - 7. daybyday - 8. e-Post
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Sep 7 14:51:50 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.