You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Erik Hülsmann <e....@gmx.net> on 2003/08/12 20:34:39 UTC

[PATCH] Add diagnostic output to svnversion_tests.py (Take 3) (was: Take 2)

Ok,

After seeing that the submitted patches had not been applied, I decided
to recheck them and resubmit the patches diffed against HEAD (6717 at 
the moment). I found some colons which caused syntax errors (I know:
sloppy!), but this time the test is runnable against rev 6717.

bye,

Erik.

The log message and patch:

[[[

  * subversion/tests/clients/cmdline/svnversion_tests.py
     - Added run_and_verify_svnversion procedure to generate
       diagnostic output when a test fails
     - rely on run_and_verify_* api to raise exceptions, not checking
       return values anymore.
]]]

Index: svnversion_tests.py
===================================================================
--- svnversion_tests.py (revision 6716)
+++ svnversion_tests.py (working copy)
@@ -30,6 +30,24 @@

 #----------------------------------------------------------------------

+def run_and_verify_svnversion(wc_dir, repo_url, expected_output):
+  "run the svnversion command and check it's output"
+  output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
+  if (expected_output and (errput or output != expected_output)):
+    print "COMMAND:\nsvnversion ", wc_dir, " ", repo_url
+    print "EXPECTED: (stdout)\n", expected_output
+    print "ACTUAL:\n", "stdout:\n", output
+    print "stderr:\n", errput
+    raise svntest.Failure
+  elif ((not expected_output) and (not errput or output)):
+    print "COMMAND:\nsvnversion ", wc_dir, " ", repo_url
+    print "EXPECTED: (stdout)\n(none)"
+    print "ACTUAL:\nstdout:\n", output
+    print "stderr:\n", errput
+    raise svntest.Failure
+
+#----------------------------------------------------------------------
+
 def svnversion_test(sbox):
   "test 'svnversion' on wc and other dirs"
   sbox.build()
@@ -37,37 +55,28 @@
   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
+  run_and_verify_svnversion(wc_dir, repo_url, [ "1\n" ])

   # Unmodified, whole wc switched
-  output, errput = svntest.main.run_svnversion(wc_dir, "some/other/url")
-  if errput or output != [ "1S\n" ]:
-    raise svntest.Failure
-
+  run_and_verify_svnversion(wc_dir, "some/other/url", [ "1S\n" ])
+
   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
+  run_and_verify_svnversion(wc_dir, repo_url, [ "1M\n" ])

   expected_output = wc.State(wc_dir, {'A/mu' : Item(verb='Sending')})
   expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
   expected_status.tweak(wc_rev=1)
   expected_status.tweak('A/mu', wc_rev=2)
-  if svntest.actions.run_and_verify_commit (wc_dir,
-                                            expected_output, expected_status,
-                                            None, None, None, None, None,
-                                            wc_dir):
-    raise svntest.Failure
+  svntest.actions.run_and_verify_commit (wc_dir,
+                                         expected_output, expected_status,
+                                         None, None, None, None, None,
+                                         wc_dir)

   # Unmodified, mixed
-  output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
-  if errput or output != [ "1:2\n" ]:
-    raise svntest.Failure
+  run_and_verify_svnversion(wc_dir, repo_url, [ "1:2\n" ])

   output, errput = svntest.main.run_svn(None, 'propset', 'blue', 'azul',
                                         os.path.join(wc_dir, 'A', 'mu'))
@@ -75,9 +84,7 @@
     raise svntest.Failure

   # Prop modified, mixed
-  output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
-  if errput or output != [ "1:2M\n" ]:
-    raise svntest.Failure
+  run_and_verify_svnversion(wc_dir, repo_url, [ "1:2M\n" ])

   iota_path = os.path.join(wc_dir, 'iota')
   gamma_url = svntest.main.current_repo_url + '/A/D/gamma'
@@ -90,36 +97,27 @@
                       + 'appended mu text')
   expected_disk.tweak('iota',
                       contents=expected_disk.desc['A/D/gamma'].contents)
-  if svntest.actions.run_and_verify_switch(wc_dir, iota_path, gamma_url,
-                                           expected_output,
-                                           expected_disk,
-                                           expected_status):
-    raise svntest.Failure
+  svntest.actions.run_and_verify_switch(wc_dir, iota_path, gamma_url,
+                                        expected_output,
+                                        expected_disk,
+                                        expected_status)

   # 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
+  run_and_verify_svnversion(wc_dir, repo_url, [ "1:2MS\n" ])

   # 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
+  run_and_verify_svnversion(Q_path, repo_url, [ "exported\n" ])

   # 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
+  run_and_verify_svnversion(R_path, repo_url, [ "exported\n" ])

   # 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
+  run_and_verify_svnversion(os.path.join(wc_dir, 'Q', 'X'),
+                            repo_url, None)


 ########################################################################

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Add diagnostic output to svnversion_tests.py (Take 3) (was: Take 2)

Posted by Sander Roobol <ph...@wanadoo.nl>.
On Tue, Aug 12, 2003 at 10:34:39PM +0200, Erik H?lsmann wrote:
> Ok,
> 
> After seeing that the submitted patches had not been applied, I decided
> to recheck them and resubmit the patches diffed against HEAD (6717 at 
> the moment). I found some colons which caused syntax errors (I know:
> sloppy!), but this time the test is runnable against rev 6717.

I've filed this patch as issue #1491:
  http://subversion.tigris.org/issues/show_bug.cgi?id=1491

You don't seem to have a tigris.org account, so I wasn't able to add you
to the CC list of the issue. You can do that yourself once you have an
account.

Sander

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org