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

[PATCH] Resolve issue 1491: let svnversion_tests.py emit error information on failure

From: Erik Huelsmann <e.huelsmann_at_gmx.net>
Date: 2004-03-15 22:04:35 CET

Hi!

Long ago I submitted a patch to make svnversion_tests.py emit error
information when failing. I think I 'upgraded' the patch to more general test-suite
standards.

Let me know what you think. I'll commit in a few days without reactions.

bye,

Erik.

Log
[[[
Resolve issue 1491: add failure information to svnversion_tests.py

* subversion/tests/clients/cmdline/svntest/actions.py
  (run_and_verify_svnversion): New. Do checks like other
   run_and_verify_* procedures

* subversion/tests/clients/cmdline/svnversion_tests.py:
  (svnversion_test): rewrite to use new run_and_verify_svnversion.

]]]

Index: subversion/tests/clients/cmdline/svnversion_tests.py
===================================================================
--- subversion/tests/clients/cmdline/svnversion_tests.py (revision 9044)
+++ subversion/tests/clients/cmdline/svnversion_tests.py (working copy)
@@ -28,6 +28,8 @@
 XFail = svntest.testcase.XFail
 Item = svntest.wc.StateItem
 
+SVNAnyOutput = svntest.SVNAnyOutput
+
 #----------------------------------------------------------------------
 
 def svnversion_test(sbox):
@@ -37,22 +39,21 @@
   repo_url = sbox.repo_url
 
   # Unmodified
- output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
- if errput or output != [ "1\n" ]:
- raise svntest.Failure
+ svntest.actions.run_and_verify_svnversion("Unmodified working copy",
+ wc_dir, repo_url,
+ [ "1\n" ], None)
 
   # Unmodified, whole wc switched
- output, errput = svntest.main.run_svnversion(wc_dir, "some/other/url")
- if errput or output != [ "1S\n" ]:
- raise svntest.Failure
+ svntest.actions.run_and_verify_svnversion("Unmodified switched working
copy",
+ wc_dir, "some/other/url",
+ [ "1S\n" ], None)
 
   mu_path = os.path.join(wc_dir, 'A', 'mu')
   svntest.main.file_append (mu_path, 'appended mu text')
 
   # Text modified
- output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
- if errput or output != [ "1M\n" ]:
- raise svntest.Failure
+ svntest.actions.run_and_verify_svnversion("Modified text", wc_dir,
repo_url,
+ [ "1M\n" ], None)
 
   expected_output = wc.State(wc_dir, {'A/mu' : Item(verb='Sending')})
   expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
@@ -65,18 +66,18 @@
     raise svntest.Failure
 
   # Unmodified, mixed
- output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
- if errput or output != [ "1:2\n" ]:
- raise svntest.Failure
+ svntest.actions.run_and_verify_svnversion("Unmodified mixed working
copy",
+ wc_dir, repo_url,
+ [ "1:2\n" ], None)
 
   svntest.actions.run_and_verify_svn(None, None, [],
                                      'propset', 'blue', 'azul',
                                      os.path.join(wc_dir, 'A', 'mu'))
 
   # Prop modified, mixed
- output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
- if errput or output != [ "1:2M\n" ]:
- raise svntest.Failure
+ svntest.actions.run_and_verify_svnversion("Property modified mixed wc",
+ wc_dir, repo_url,
+ [ "1:2M\n" ], None)
 
   iota_path = os.path.join(wc_dir, 'iota')
   gamma_url = svntest.main.current_repo_url + '/A/D/gamma'
@@ -96,29 +97,28 @@
     raise svntest.Failure
 
   # Prop modified, mixed, part wc switched
- output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
- if errput or output != [ "1:2MS\n" ]:
- raise svntest.Failure
+ svntest.actions.run_and_verify_svnversion("Prop-mod mixed partly
switched",
+ wc_dir, repo_url,
+ [ "1:2MS\n" ], None)
 
   # Plain (exported) directory that is a direct subdir of a versioned dir
   Q_path = os.path.join(wc_dir, 'Q')
   os.mkdir(Q_path)
- output, errput = svntest.main.run_svnversion(Q_path, repo_url)
- if errput or output != [ "exported\n" ]:
- raise svntest.Failure
+ svntest.actions.run_and_verify_svnversion("Exported subdirectory",
+ Q_path, repo_url,
+ [ "exported\n" ], None)
 
   # Plain (exported) directory that is not a direct subdir of a versioned
dir
   R_path = os.path.join(Q_path, 'Q')
   os.mkdir(R_path)
- output, errput = svntest.main.run_svnversion(R_path, repo_url)
- if errput or output != [ "exported\n" ]:
- raise svntest.Failure
+ svntest.actions.run_and_verify_svnversion("Exported directory",
+ R_path, repo_url,
+ [ "exported\n" ], None)
 
   # No directory generates an error
- output, errput = svntest.main.run_svnversion(os.path.join(wc_dir, 'Q',
'X'),
- repo_url)
- if not errput or output:
- raise svntest.Failure
+ svntest.actions.run_and_verify_svnversion("None existent directory",
+ os.path.join(wc_dir, 'Q', 'X'),
+ repo_url, None, SVNAnyOutput)
 
 
 ########################################################################
Index: subversion/tests/clients/cmdline/svntest/actions.py
===================================================================
--- subversion/tests/clients/cmdline/svntest/actions.py (revision 9044)
+++ subversion/tests/clients/cmdline/svntest/actions.py (working copy)
@@ -130,7 +130,33 @@
   # make the repos world-writeable, for mod_dav_svn's sake.
   main.chmod_tree(path, 0666, 0666)
 
+def run_and_verify_svnversion(message, wc_dir, repo_url,
+ expected_stdout, expected_stderr):
+ "Run svnversion command and check it's output"
 
+ out, err = main.run_svnversion(wc_dir, repo_url)
+
+ if type(expected_stdout) is type([]):
+ compare_and_display_lines(message, 'STDOUT', expected_stdout, out)
+ 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_stdout) is type([]):
+ compare_and_display_lines(message, 'STDOUT', expected_stdout, out)
+ 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")
+
+
+
+
 def run_and_verify_svn(message, expected_stdout, expected_stderr,
*varargs):
   """Invokes main.run_svn with *VARARGS. If EXPECTED_STDOUT or
   EXPECTED_STDERR is not 'None', invokes compare_and_display_lines

-- 
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Mar 15 22:05:09 2004

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.