Michael Haggerty <mhagger@alum.mit.edu> (mhagger)

Patch Suggested
r878693, r878691, r878560, r871600, r865863, r865603, r865602, r862427, r861949, r859543, r859540, r859539, r859538, r859537, r859475, r859404, r859403, r859392, r859391, r859355, r859354, r859351, r859350, r859348, r859347, r859346, r859345, r859344, r859343, r859342, r859341, r859323, r859322, r859321, r859320, r859319, r859318, r859317, r859315, r859314, r859313, r859312, r859311, r859310, r859309, r859308, r859307, r859306, r859305, r859304, r859303, r859302, r859252, r859219, r859218 r869481, r864533

r859218 | dlr | 2006-04-03 21:25:41 +0000 (Mon, 03 Apr 2006)

Allow multiple unit tests to be run at once.

Previously, a Python unit test script could run *all* of its tests, or
exactly *one* of them.  This change allows an arbitrary selection of
tests to be run in one invocation of a test script.

For orthogonality, the "list" subcommand was also changed to list the
docstrings only for the tests that would otherwise have been executed.
(Thus, "test-script.py list" lists all tests, whereas "test-script.py
list 12 13" lists the information only for tests 12 and 13.)

* subversion/tests/cmdline/svntest/main.py
  (_internal_run_tests): Change second argument from an optional
   integer to a required list of integers.  All tests whose numbers
   are in the list are executed.

  (run_tests): Allow multiple test numbers to be specified on the
   command line.  Process the list subcommand only after all
   command-line parameters have been parsed, and if any test numbers
   were passed as arguments, only list the information for those
   tests.  Update function comment.

* subversion/tests/cmdline/README
  Updated documentation to describe the new possibilities.

Patch by: Michael Haggerty <mhagger@alum.mit.edu>
Review by: me

r859219 | dlr | 2006-04-03 21:30:36 +0000 (Mon, 03 Apr 2006)

Remove some unnecessary variable initializations.

* tools/dev/normalize-dump.py
  (parse_file): Removed some unnecessary local variable
   initializations: harvesting (was never referenced); headers and eof
   (because they are set unconditionally a few lines later and are
   only needed within the while loop).

Patch by: Michael Haggerty <mhagger@alum.mit.edu>
Review by: me

r859252 | dlr | 2006-04-04 20:20:34 +0000 (Tue, 04 Apr 2006)

Add a "--list" option (with the same meaning as the "list"
subcommand), which deprecates but does not remove the "list"

* subversion/tests/cmdline/svntest/main.py
  (run_tests): Added a --list option, with the same meaning as the old
   "list" subcommand.

* subversion/tests/cmdline/README
  Updated documentation to reflect change.

Patch by: Michael Haggerty <mhagger@alum.mit.edu>

r859302 | mhagger | 2006-04-07 20:03:37 +0000 (Fri, 07 Apr 2006)

Delete trailing whitespace from Python lines.

[in subversion/tests/cmdline/svntest]

* actions.py, entry.py, main.py, testcase.py, tree.py, wc.py: Delete
  trailing whitespace from Python lines.

r859303 | mhagger | 2006-04-07 21:10:57 +0000 (Fri, 07 Apr 2006)

Move the decision about whether a TestCase needs a sandbox to TestCase class.

[in subversion/tests/cmdline/svntest]

* testcase.py (TestCase.need_sandbox): New method.  Code taken from

* main.py (run_one_test): Use new TestCase.need_sandbox() method.

r859304 | mhagger | 2006-04-07 21:19:25 +0000 (Fri, 07 Apr 2006)

Added method TestCase.get_sandbox_name().

[in subversion/tests/cmdline/svntest]

* testcase.py (TestCase.get_sandbox_name): New method.  Code taken
  from main.run_one_test().

* main.py (run_one_test): Use new TestCase.get_sandbox_name() method.

r859305 | mhagger | 2006-04-07 21:22:29 +0000 (Fri, 07 Apr 2006)

Removed unused local variable.

* subversion/tests/cmdline/main.py (run_one_test): Removed unused
  local variable "func_code".

r859306 | mhagger | 2006-04-07 21:28:31 +0000 (Fri, 07 Apr 2006)

Make TestCase.func_code() private.

* subversion/tests/cmdline/svntest/testcase.py (TestCase._func_code):
  New method, renamed from func_code() to indicate that the method
  should be considered private.

  (TestCase.need_sandbox, TestCase.get_sandbox_name): Invoke method
  by new name.

r859307 | mhagger | 2006-04-07 21:38:20 +0000 (Fri, 07 Apr 2006)

Re-ordered class definitions (moved _Predicate classes next to each other).

* subversion/tests/cmdline/svntest/testcase.py: Re-ordered class
  definitions to move _Predicate and the two classes derived from it
  (XFail and Skip) together.

r859308 | mhagger | 2006-04-07 21:49:31 +0000 (Fri, 07 Apr 2006)

Added method _Predicate.get_description().

* subversion/tests/cmdline/svntest/testcase.py
  (_Predicate.get_description): New method.

  (TestCase._check_name, TestCase.list, test_case._print_name): Use
  new method.

r859309 | mhagger | 2006-04-07 21:55:32 +0000 (Fri, 07 Apr 2006)

Moved TestCase._check_name() functionality to _Predicate class.

* subversion/tests/cmdline/svntest/testcase.py
  (_Predicate.check_description): New method (moved from

  (TestCase.list, TestCase._print_name): Use new method.

r859310 | mhagger | 2006-04-07 21:58:24 +0000 (Fri, 07 Apr 2006)

Renamed local variable.

* subversion/tests/cmdline/svntest/testcase.py
  (_Predicate.check_description): Renamed local variable "name" to
  "description" to be consistent with the method name.

r859311 | mhagger | 2006-04-07 22:02:20 +0000 (Fri, 07 Apr 2006)

Moved test that description is present to get_description().

* subversion/tests/cmdline/svntest/testcase.py
  (_Predicate.get_description): Move test that a __doc__ string is
  available from check_description() to this method.

  (_Predicate.check_description): Removed test that __doc__ string is

r859312 | mhagger | 2006-04-07 22:14:15 +0000 (Fri, 07 Apr 2006)

Moved guts of TestCase.need_sandbox() and get_sandbox_name() to _Predicate.

* subversion/tests/cmdline/svntest/testcase.py
  (_Predicate.need_sandbox, _Predicate.get_sandbox_name): New methods
  (bodies adapted from TestCase class methods of same names).

  (TestCase.need_sandbox, TestCase.get_sandbox_name): Delegate work to
  _Predicate instance.

  (TestCase._func_code): Deleted (unneeded).

r859313 | mhagger | 2006-04-07 22:49:56 +0000 (Fri, 07 Apr 2006)

Move TestCase class to main.py and rename to TestRunner.

[in subversion/tests/cmdline/svntest]

* main.py (TestRunner): New class, moved from testcase.TestCase and
  renamed to more accurately reflect its role.

  (SVNTestStatusCodeError): New class, moved from testcase.

* testcase.py (TestCase, SVNTestStatusCodeError): Classes removed
  (code moved to main.py).

  (create_predicate): Factory function for creating _Predicate
  instances.  (It is planned to rename _Predicate and
  create_predicate() at a later time, but for now I continue to use
  the old names.

r859314 | mhagger | 2006-04-07 23:00:21 +0000 (Fri, 07 Apr 2006)

Move sandbox handling from run_one_test() to TestRunner.run().

* subversion/tests/cmdline/svntest/main.py (TestRunner.run): Manage
  the sandbox (if needed) within this method.  Now the method doesn't
  need an argument.  (Sandbox-handling code moved from

  (run_one_test): Don't handle sandbox here anymore.  Removed local
  variable "tc".

r859315 | mhagger | 2006-04-07 23:04:42 +0000 (Fri, 07 Apr 2006)

Inlined methods TestRunner.need_sandbox() and get_sandbox_name().

* subversion/tests/cmdline/svntest/main.py (TestRunner.need_sandbox,
  get_sandbox_name): Methods removed (inlined at callers).

  (TestRunner.run): Invoke self.pred.need_sandbox() and
  self.pred.get_sandbox_name() directly.

r859317 | mhagger | 2006-04-07 23:17:30 +0000 (Fri, 07 Apr 2006)

* subversion/tests/cmdline/svntest/main.py (TestRunner.run): Fixed docstring.

r859318 | mhagger | 2006-04-07 23:35:51 +0000 (Fri, 07 Apr 2006)

Corrected "how to use module" comment in svntest/main.py.

* subversion/tests/cmdline/svntest/main.py: Corrected "how to use
  module" comment.

r859319 | mhagger | 2006-04-07 23:39:57 +0000 (Fri, 07 Apr 2006)

Removed SVNTestStatusCodeError exception class.

* subversion/tests/cmdline/svntest/main.py (TestRunner.run): There is
  no need to raise an SVNTestStatusCodeError exception on one line and
  catch it on the next one.  Just do the error-handling inline.

  (SVNTestStatusCodeError): Removed class.

r859320 | mhagger | 2006-04-07 23:56:47 +0000 (Fri, 07 Apr 2006)

Handle Skip conditions by throwing exception.

* subversion/tests/cmdline/svntest/main.py (TestRunner.run): Check for
  pred.cond within the try...except and if it is true, just raise a
  Skip exception.  This is then handled the same way as a Skip thrown
  by the test itself.

r859321 | mhagger | 2006-04-08 00:00:45 +0000 (Sat, 08 Apr 2006)

Add method _Predicate.run().

[in subversion/tests/cmdline/svntest]

* testcase.py (_Predicate.run): New method.

* main.py (TestRunner.run): Invoke new _Predicate method.

r859322 | mhagger | 2006-04-08 00:06:17 +0000 (Sat, 08 Apr 2006)

Move check of _Predicate.cond from TestCase.run() to _Predicate.run().

[in subversion/tests/cmdline/svntest]

* testcase.py (_Predicate.run): Check self.cond before invoking test
  function.  Raise a Skip exception if cond is set.

* main.py (TestRunner.run): Don't need to check self.pred.cond anymore.

r859323 | mhagger | 2006-04-08 00:13:33 +0000 (Sat, 08 Apr 2006)

Move cond member from _Predicate to Skip class.

* subversion/tests/cmdline/svntest/testcase.py (_Predicate.__init__):
  Don't initialize cond at all in _Predicate class.

  (_Predicate.run): Don't check cond in _Predicate class.

  (Skip.run): Check cond member here.  If it is set, raise a Skip
  exception; if not, invoke the inherited run() method.

r859341 | mhagger | 2006-04-08 21:18:56 +0000 (Sat, 08 Apr 2006)

Fixed imports.

[in subversion/tests/cmdline/svntest]

* main.py: Import traceback.

* testcase.py: Don't import traceback anymore.

r859342 | mhagger | 2006-04-08 21:32:03 +0000 (Sat, 08 Apr 2006)

Don't initialize result; only set it when its correct value is known.

* subversion/tests/cmdline/svntest/main.py (TestRunner.run): Don't
  initialize result.

r859343 | mhagger | 2006-04-08 22:25:14 +0000 (Sat, 08 Apr 2006)

Create an abstract base class TestCase, from which _Predicate inherits.

[in subversion/tests/cmdline/svntest]

* testcase.py (TestCase): New class.  Some method bodies for
  check_description() and convert_result() taken from _Predicate.

  (_Predicate): Inherit from TestCase.  Use inherited definitions of
  check_description() and convert_result().

  (create_test_case): New function (renamed from create_predicate()).

* main.py (TestRunner.__init__): Call testcase.create_test_case() by
  its new name.

r859344 | mhagger | 2006-04-08 22:34:46 +0000 (Sat, 08 Apr 2006)

Removed unused method skip_text().

* subversion/tests/cmdline/svntest/testcase.py (TestCase.skip_text,
  _Predicate.skip_text): Removed methods (unused).

r859345 | mhagger | 2006-04-08 22:45:25 +0000 (Sat, 08 Apr 2006)

Separate list mode text from result text in _Predicate.

The text that depends on the result value is stored in
_Predicate._result_text, which is an array with three elements.  The
text output to show the mode in lists doesn't need to be in the same
array, so I separated it out.

* subversion/tests/cmdline/svntest/testcase.py
  (_Predicate._result_text, _Predicate._list_mode_text): New member
  variables, created from the now-deleted _Predicate.text member.

  (_Predicate.list_mode, _Predicate.run_text, XFail.__init__,
  Skip.__init__): Use the new members.

r859346 | mhagger | 2006-04-08 22:55:00 +0000 (Sat, 08 Apr 2006)

Pull up definitions of list_mode() and run_text() from _Predicate to TestCase.

* subversion/tests/cmdline/svntest/testcase.py (TestCase._result_text,
  TestCase._list_mode_text): New members (pulled up from _Predicate).

  (TestCase.list_mode, TestCase.run_text): Pulled up definitions of
  these methods from _Predicate.

r859347 | mhagger | 2006-04-08 23:12:40 +0000 (Sat, 08 Apr 2006)

Don't wrap something that is already a TestCase.

This modification allows any user-created class that inherit from
TestCase to be used as a test (though such tests may not yet be
wrapped in XFail or Skip).

* subversion/tests/cmdline/svntest/testcase.py (create_test_case):
  Check if func is already an instance of TestCase.  If so, don't wrap

r859348 | mhagger | 2006-04-08 23:23:15 +0000 (Sat, 08 Apr 2006)

Don't check type of func redundantly.

If func is an instance of _Predicate, then it's func member has
necessarily already been checked to be a pure function, so skip that

* subversion/tests/cmdline/svntest/testcase.py (_Predicate.__init__):
  Don't test the type of func if it was taken from another _Predicate

r859350 | mhagger | 2006-04-08 23:30:51 +0000 (Sat, 08 Apr 2006)

Rewrite XFail to wrap a TestCase instead of inheriting from _Predicate.

Previously, XFail inherited from _Predicate, and due to the peculiar
implementation of _Predicate, this only allowed XFail to wrap
_Predicates or naked functions, but not arbitrary TestCases.

This commit changes XFail to inherit directly from TestCase and to
wrap an arbitrary instance of TestCase.  Most methods are delegated to
the wrapped TestCase, and some are implemented in XFail to modify the

* subversion/tests/cmdline/svntest/testcase.py (XFail): Rewritten as
  described above.

r859351 | mhagger | 2006-04-08 23:38:23 +0000 (Sat, 08 Apr 2006)

Rewrite Skip to wrap a TestCase instead of inheriting from _Predicate.

Previously, Skip inherited from _Predicate, and due to the peculiar
implementation of _Predicate, this only allowed Skip to wrap
_Predicates or naked functions, but not arbitrary TestCases.

This commit changes Skip to inherit directly from TestCase and to wrap
an arbitrary instance of TestCase.  Most methods are delegated to the
wrapped TestCase, and some are implemented in Skip to modify the

* subversion/tests/cmdline/svntest/testcase.py (Skip): Rewritten as
  described above.

r859354 | mhagger | 2006-04-08 23:49:25 +0000 (Sat, 08 Apr 2006)

Don't allow a _Predicate to take over the identity of another _Predicate.

Previously, the _Predicate constructor could take either a naked
function object or another _Predicate as argument.  If the argument
was a _Predicate instance, it would take over the identity of the
other instance.  (This cute trick essentially allows another class to
inherit dynamically from any class that itself inherits from

For the unenlightened, the above-mentioned trick has the disadvantage
that it leads to extremely tight coupling between _Predicate and the
classes derived from it, decreasing maintainability and limiting the
uses of the derived classes.

Now that no more classes inherit from _Predicate, this trick is no
longer needed.

* subversion/tests/cmdline/svntest/testcase.py (_Predicate.__init__):
  Only allow a _Predicate to be constructed using a naked function
  object, not using another _Predicate.

r859355 | mhagger | 2006-04-09 00:04:03 +0000 (Sun, 09 Apr 2006)

Renamed _Predicate to FunctionTestCase and improved documentation.

* subversion/tests/cmdline/svntest/testcase.py (FunctionTestCase): New
  class, renamed from _Predicate.  Also improved the class and method

  (create_test_case): Construct class using new name.

r859391 | mhagger | 2006-04-12 05:31:41 +0000 (Wed, 12 Apr 2006)

If a test skips, clean up its sandbox.

Previously only tests whose converted results indicated a pass had
their sandboxes cleaned up.

* subversion/tests/cmdline/svntest/main.py (TestRunner.run): Only omit
  sandbox cleanup for tests that result in a failure (not tests that

r859392 | mhagger | 2006-04-12 05:34:53 +0000 (Wed, 12 Apr 2006)

If an XFail test throws a Skip exception, then treat it as a skip.

Currently, XFail converts a "skip" result into a "pass".  But a "skip"
should remain a "skip".  (But since the pre-converted value is used to
choose what test result to output, this modification does not change
the printed output of any tests.)

* subversion/tests/cmdline/svntest/testcase.py (XFail.convert_result):
  Convert pass->fail, fail->pass, but leave skip->skip unchanged.

r859403 | mhagger | 2006-04-12 19:48:42 +0000 (Wed, 12 Apr 2006)

Provide a default value cond=1 for Skip's constructor argument.

Well, a default of 0 wouldn't make much sense, would it?

* subversion/tests/cmdline/testcase.py (Skip.__init__): The "cond"
  constructor argument gets a default value of 1, meaning "skip".
  Also improved docstring.

r859404 | mhagger | 2006-04-12 20:21:35 +0000 (Wed, 12 Apr 2006)

Use types.FunctionType instead of type(lambda x: 0).

* subversion/tests/cmdline/svntest/testcase.py: Import types.

  (FunctionTestCase.__init__): Use types.FunctionType instead of
  type(lambda x: 0).

r859475 | mhagger | 2006-04-17 22:03:58 +0000 (Mon, 17 Apr 2006)

Suppress sandbox creation for tests that are going to be skipped.

* subversion/tests/cmdline/svntest/testcase.py (Skip.need_sandbox): If
  self.cond is true, then return false instead of delegating to

r859537 | mhagger | 2006-04-27 23:15:01 +0000 (Thu, 27 Apr 2006)

Rename XFail "cond" constructor argument to cond_func.

This is to avoid confusion with the cond argument to Skip's
constructor, which is a simple boolean variable.

* subversion/tests/cmdline/svntest/testcase.py (XFail.__init__,
  XFail.convert_result): Rename cond to cond_func.

r859538 | mhagger | 2006-04-27 23:17:49 +0000 (Thu, 27 Apr 2006)

Use lambda:1 as the default initializer for XFail.cond_func.

This avoid having to check it against None before using it.

* subversion/tests/cmdline/svntest/testcase.py (XFail.__init__): Use
  lambda:1 as the default initializer for XFail.cond_func.

  (XFail.convert_result): No need to test cond_func against None
  before calling it.

r859539 | mhagger | 2006-04-27 23:22:29 +0000 (Thu, 27 Apr 2006)

Don't invert the return results of XFail unless cond_func returns true.

* subversion/tests/cmdline/svntest/testcase.py (XFail.convert_result):
  Only invert the return result if self.cond_func returns true.

r859540 | mhagger | 2006-04-27 23:27:18 +0000 (Thu, 27 Apr 2006)

Alter the XFail decorator to be immutable again.

* subversion/tests/cmdline/svntest/testcase.py (XFail.__init__): Add
  comment about the deferred evaluation of cond_func.

  (XFail.convert_result): Don't modify self._result_text.

  (XFail.run_text): New method, overriding method from base class.  If
  self.cond_func returns true, then output run_text appropriate for a
  test that is expected to fail.

r859543 | mhagger | 2006-04-28 14:05:53 +0000 (Fri, 28 Apr 2006)

Improved documentation for XFail.__init__.

Suggested by: Daniel Rall <dlr@collab.net>

* subversion/tests/cmdline/svntest/testcase.py (XFail.__init__):
  Improve documentation and converted it from a comment to a

r861949 | mhagger | 2006-10-10 21:56:06 +0000 (Tue, 10 Oct 2006)

Add some missing spaces where words had somehow gotten mashedtogether.

* www/design.html: Add some missing spaces.

r862427 | mhagger | 2006-11-19 23:37:33 +0000 (Sun, 19 Nov 2006)

Iff a TestCase needs a Sandbox, pass it in as a keyword argument.

Previously TestCase.run() was always passed a tuple argument, which
sometimes (depending on TestCase.need_sandbox()) contained a sandbox.

* subversion/tests/cmdline/svntest/testcase.py (TestCase.need_sandbox,
  TestCase.get_sandbox_name): Add docstrings.

  (TestCase.run): Make sandbox into a keyword argument, and add a
  docstring that tells how the method will be called.

  (FunctionTestCase.run): Make sandbox into a keyword argument, and
  pass it to the delegate as a keyword argument.

* subversion/tests/cmdline/svntest/main.py (TestRunner.run): Pass
  sandbox to test case as a keyword argument.

r864533 | hwright | 2007-04-05 20:09:24 +0000 (Thu, 05 Apr 2007)

Followup to r24383.  Define boolean values False and True if they aren't
provided by the Python running the tests.  (These were added in Python 2.2.)

Suggested by: mhagger

* subversion/tests/cmdline/svntest/main.py
  Try to use False.  If that throws and exception, define True and False.

r865602 | mhagger | 2007-06-24 22:20:13 +0000 (Sun, 24 Jun 2007)

Extract a function to quote command-line arguments.

This is just a refactoring, with no change of functionality.  More to

* subversion/tests/cmdline/svntest/main.py (_quote_arg): New function,
  using code taken from spawn_process().

  (spawn_process): Use the new function for quoting command-line

r865603 | mhagger | 2007-06-24 22:31:25 +0000 (Sun, 24 Jun 2007)

Don't gratuitously quote harmless command-line arguments.

If a command-line argument obviously doesn't need to be quoted, then
don't quote it.  Using a conservative definition of "safe" that should
nevertheless greatly reduce the amount of gratuitous quotation.

* subversion/tests/cmdline/svntest/main.py (_safe_arg_re): New module

  (_quote_arg): If the argument matches the regular expression in
  _safe_arg_re, then don't quote it at all.

r865863 | mhagger | 2007-07-19 11:24:51 +0000 (Thu, 19 Jul 2007)

Fix dumpfile example in notes/dump-load-format.txt.

Approved by: Daniel Rall <dlr@collab.net>

* notes/dump-load-format.txt: Fix character count for log message.

r869481 | kfogel | 2008-02-17 22:11:32 +0000 (Sun, 17 Feb 2008)

* www/faq.html (cvs2svn): Remove obsolete FUD from this entry.

Suggested by: mhagger

r871600 | glasser | 2008-05-29 20:13:58 +0000 (Thu, 29 May 2008)

Consistently omit leading '/' characters in node paths.

The specification was previously inconsistent on whether node paths
should include a leading '/' character.  The output of "svnadmin dump"
omits the characters, so change the file to consistently use that

* notes/dump-load-format.txt
  Remove leading '/' characters that appear in node paths.

Patch by: Michael Haggerty <mhagger@alum.mit.edu>

r878560 | mhagger | 2009-07-28 20:34:39 +0000 (Tue, 28 Jul 2009)

Read svn properties in XML rather than text format in test suite.

This makes the routine more robust to strange property values.  It also
makes it immune to changes in the text output format, as happened
between svn 1.5 and 1.6.  (This is useful for the cvs2svn project,
which uses the svntest infrastructure but doesn't want to care what
version of svn the user has installed.)

* subversion/tests/cmdline/svntest/tree.py
  (get_props): Read svn properties via "svn proplist -v" using the
  "--xml" option.

r878691 | mhagger | 2009-08-07 14:52:46 +0000 (Fri, 07 Aug 2009)

Return the command as a string, rather than as a list, from open_pipe().

The COMMAND value returned from open_pipe() as part of the WAITER
return value is only used to generate error messages, so return it as
a string rather than as a list of strings.  Change wait_on_pipe()

* subversion/tests/cmdline/svntest/main.py

  (open_pipe): Return the command as a string rather than as a list of
  strings.  Rename local variable command_list -> command_string to
  reflect its new type.

  (wait_on_pipe): Expect a string rather than a list of strings as the
  second element of the WAITER argument.  Rename local variable
  command -> command_string to make its type more obvious.

r878693 | mhagger | 2009-08-07 16:27:38 +0000 (Fri, 07 Aug 2009)

Under Windows, display failing command lines in their quoted form.

The quoting can affect how the command is executed, so display the
quoted form to make it easier to debug the problem.

* subversion/tests/cmdline/svntest/main.py

  (open_pipe): Under Windows, return the *quoted* command line as part
  of the WAITER return value.