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

[PATCH] commit_tests.py test 15 converted to exception handling

From: Erik Hülsmann <e.huelsmann_at_gmx.net>
Date: 2003-09-06 13:20:04 CEST
('binary' encoding is not supported, stored as-is) Fitz,

As promised I would send in a patch where both commit_tests 15 is converted to the exception handling and the pickyness of svntest.actions.run_and_verify_svn with respect to the types of arguments it gets is increased. Before this patch tests will *always* pass when tuples are passed to run_and_verify_svn for the expected_output or expected_error.

Learning from my previous experience, I decided to split up the test in two parts:
1) run_and_verify_svn pickyness
2) commit_tests 15

Hope you like these more than the big patch from last week! :-)

bye,

Erik.

Log:
[[[

* subversion/tests/clients/cmdline/svntest/actions.py
  Check expected_stdout and expected_stderr for allowed
  value types and bail out if no match

]]]

Index: svn/subversion/tests/clients/cmdline/svntest/actions.py
===================================================================
--- svn/subversion/tests/clients/cmdline/svntest/actions.py (revision 6924)
+++ svn/subversion/tests/clients/cmdline/svntest/actions.py (working copy)
@@ -46,6 +46,12 @@
   STDERR when output was expected."""
   pass

+class SVNIncorrectDatatype(SVNUnexpectedOutput):
+ """Exception raised if invalid input is passed to the
+ run_and_verify_* API"""
+ pass
+
+
 ######################################################################
 # Used by every test, so that they can run independently of
 # one another. The first time it's run, it executes 'svnadmin' to
@@ -138,17 +144,21 @@

   if type(expected_stdout) is type([]):
     compare_and_display_lines(message, 'STDOUT', expected_stdout, out)
- if expected_stdout == SVNAnyOutput:
+ elif expected_stdout == SVNAnyOutput:
     if len(out) == 0:
       if message is not None: print message
       raise SVNExpectedStdout
-
+ elif expected_stdout is not None:
+ raise SVNIncorrectDatatype("Unexpected specification for stdout data")
+
   if type(expected_stderr) is type([]):
     compare_and_display_lines(message, 'STDERR', expected_stderr, err)
- if expected_stderr == SVNAnyOutput:
+ elif expected_stderr == SVNAnyOutput:
     if len(err) == 0:
       if message is not None: print message
       raise SVNExpectedStderr
+ elif expected_stderr is not None:
+ raise SVNIncorrectDatatype("Unexpected specification for stderr data")
   return out, err

Log:
[[[
convert commit_tests.py test 15 to new exception based system

* subversion/tests/clients/cmdline/commit_tests.py
  convert expected_output from tuple to list:
  run_and_verify_svn does not allow tuples

]]]

Index: subversion/tests/clients/cmdline/commit_tests.py
===================================================================
--- subversion/tests/clients/cmdline/commit_tests.py (revision 6995)
+++ subversion/tests/clients/cmdline/commit_tests.py (working copy)
@@ -860,8 +860,7 @@
 def hook_test(sbox):
   "hook testing"

- if sbox.build():
- return 1
+ sbox.build()

   # Get paths to the working copy and repository
   wc_dir = sbox.wc_dir
@@ -894,19 +893,13 @@
   # filesystem will report an absolute path because that's the way the
   # filesystem is created by this test suite.
   abs_repo_dir = os.path.abspath (repo_dir)
- expected_output = (abs_repo_dir + "\n",
- abs_repo_dir + " 1\n",
- abs_repo_dir + " 2\n")
- output, errput = svntest.main.run_svn (None, 'ci', '--quiet',
- '-m', 'log msg', wc_dir)
+ expected_output = [ abs_repo_dir + "\n",
+ abs_repo_dir + " 1\n",
+ abs_repo_dir + " 2\n" ]
+ svntest.actions.run_and_verify_svn (None, expected_output, None,
+ 'ci', '--quiet',
+ '-m', 'log msg', wc_dir)

- # Make sure we got the right output.
- if output != expected_output:
- return 1
-
- return 0
-
-
 #----------------------------------------------------------------------

 # Regression test for bug #469, whereby merge() was once reporting

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Sep 6 13:21:21 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.