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

Re: svn commit: r25357 - in trunk/subversion/tests/cmdline: . svntest

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2007-06-14 16:18:41 CEST

Dan,

Looks fine with me.

I had a similar patch, i.e instead of SkipUnless, making Skip to accept
expected val from the conditional.

With regards
Kamesh Jayachandran
Daniel Rall wrote:
> On Tue, 12 Jun 2007, David Glasser wrote:
>
>
>> On 6/12/07, Kamesh Jayachandran <kamesh@collab.net> wrote:
>>
>>> I originally thought on the same lines. But I could not pass a negating
>>> expression as a lambda function.
>>>
>> SkipUnless?
>>
>
> Ah, good suggestion. How about this patch (attached), which adds and
> uses the new predicate?
>
> ------------------------------------------------------------------------
>
> Index: subversion/tests/cmdline/import_tests.py
> ===================================================================
> --- subversion/tests/cmdline/import_tests.py (revision 25383)
> +++ subversion/tests/cmdline/import_tests.py (working copy)
> @@ -25,6 +25,7 @@
>
> # (abbreviation)
> Skip = svntest.testcase.Skip
> +SkipUnless = svntest.testcase.SkipUnless
> XFail = svntest.testcase.XFail
> Item = wc.StateItem
>
> @@ -369,7 +370,7 @@
>
> # list all tests here, starting with None:
> test_list = [ None,
> - Skip(import_executable, svntest.main.is_non_posix_os),
> + SkipUnless(import_executable, svntest.main.is_posix_os),
> import_ignores,
> import_avoid_empty_revision,
> import_no_ignores,
> Index: subversion/tests/cmdline/lock_tests.py
> ===================================================================
> --- subversion/tests/cmdline/lock_tests.py (revision 25383)
> +++ subversion/tests/cmdline/lock_tests.py (working copy)
> @@ -27,6 +27,7 @@
>
> # (abbreviation)
> Skip = svntest.testcase.Skip
> +SkipUnless = svntest.testcase.SkipUnless
> XFail = svntest.testcase.XFail
> Item = svntest.wc.StateItem
>
> @@ -1552,8 +1553,8 @@
> lock_several_files,
> lock_switched_files,
> lock_uri_encoded,
> - Skip(lock_and_exebit1, svntest.main.is_non_posix_os),
> - Skip(lock_and_exebit2, svntest.main.is_non_posix_os),
> + SkipUnless(lock_and_exebit1, svntest.main.is_posix_os),
> + SkipUnless(lock_and_exebit2, svntest.main.is_posix_os),
> commit_xml_unsafe_file_unlock,
> repos_lock_with_info,
> unlock_already_unlocked_files,
> Index: subversion/tests/cmdline/copy_tests.py
> ===================================================================
> --- subversion/tests/cmdline/copy_tests.py (revision 25383)
> +++ subversion/tests/cmdline/copy_tests.py (working copy)
> @@ -27,6 +27,7 @@
>
> # (abbreviation)
> Skip = svntest.testcase.Skip
> +SkipUnless = svntest.testcase.SkipUnless
> XFail = svntest.testcase.XFail
> Item = svntest.wc.StateItem
>
> @@ -3689,7 +3690,8 @@
> copy_files_with_properties,
> copy_delete_commit,
> mv_and_revert_directory,
> - Skip(copy_preserve_executable_bit, svntest.main.is_non_posix_os),
> + SkipUnless(copy_preserve_executable_bit,
> + svntest.main.is_posix_os),
> wc_to_repos,
> repos_to_wc,
> copy_to_root,
> Index: subversion/tests/cmdline/stat_tests.py
> ===================================================================
> --- subversion/tests/cmdline/stat_tests.py (revision 25383)
> +++ subversion/tests/cmdline/stat_tests.py (working copy)
> @@ -26,6 +26,7 @@
>
> # (abbreviation)
> Skip = svntest.testcase.Skip
> +SkipUnless = svntest.testcase.SkipUnless
> XFail = svntest.testcase.XFail
> Item = svntest.wc.StateItem
>
> @@ -1498,7 +1499,8 @@
> status_shows_all_in_current_dir,
> status_missing_file,
> status_type_change,
> - Skip(status_type_change_to_symlink, svntest.main.is_non_posix_os),
> + SkipUnless(status_type_change_to_symlink,
> + svntest.main.is_posix_os),
> status_with_new_files_pending,
> status_for_unignored_file,
> status_for_nonexistent_file,
> Index: subversion/tests/cmdline/special_tests.py
> ===================================================================
> --- subversion/tests/cmdline/special_tests.py (revision 25383)
> +++ subversion/tests/cmdline/special_tests.py (working copy)
> @@ -25,6 +25,7 @@
>
> # (abbreviation)
> Skip = svntest.testcase.Skip
> +SkipUnless = svntest.testcase.SkipUnless
> XFail = svntest.testcase.XFail
> Item = svntest.wc.StateItem
>
> @@ -605,19 +606,19 @@
>
> # list all tests here, starting with None:
> test_list = [ None,
> - Skip(general_symlink, svntest.main.is_non_posix_os),
> - Skip(replace_file_with_symlink, svntest.main.is_non_posix_os),
> - Skip(import_export_symlink, svntest.main.is_non_posix_os),
> - Skip(copy_tree_with_symlink, svntest.main.is_non_posix_os),
> - Skip(replace_symlink_with_file, svntest.main.is_non_posix_os),
> - Skip(remove_symlink, svntest.main.is_non_posix_os),
> - Skip(merge_symlink_into_file, svntest.main.is_non_posix_os),
> - Skip(merge_file_into_symlink, svntest.main.is_non_posix_os),
> + SkipUnless(general_symlink, svntest.main.is_posix_os),
> + SkipUnless(replace_file_with_symlink, svntest.main.is_posix_os),
> + SkipUnless(import_export_symlink, svntest.main.is_posix_os),
> + SkipUnless(copy_tree_with_symlink, svntest.main.is_posix_os),
> + SkipUnless(replace_symlink_with_file, svntest.main.is_posix_os),
> + SkipUnless(remove_symlink, svntest.main.is_posix_os),
> + SkipUnless(merge_symlink_into_file, svntest.main.is_posix_os),
> + SkipUnless(merge_file_into_symlink, svntest.main.is_posix_os),
> checkout_repo_with_symlinks,
> - XFail(Skip(diff_symlink_to_dir, svntest.main.is_non_posix_os)),
> + XFail(SkipUnless(diff_symlink_to_dir, svntest.main.is_posix_os)),
> checkout_repo_with_unknown_special_type,
> replace_symlink_with_dir,
> - Skip(update_obstructing_symlink, svntest.main.is_non_posix_os),
> + SkipUnless(update_obstructing_symlink, svntest.main.is_posix_os),
> ]
>
> if __name__ == '__main__':
> Index: subversion/tests/cmdline/prop_tests.py
> ===================================================================
> --- subversion/tests/cmdline/prop_tests.py (revision 25383)
> +++ subversion/tests/cmdline/prop_tests.py (working copy)
> @@ -25,12 +25,13 @@
>
> # (abbreviation)
> Skip = svntest.testcase.Skip
> +SkipUnless = svntest.testcase.SkipUnless
> XFail = svntest.testcase.XFail
> Item = svntest.wc.StateItem
>
> def is_non_posix_and_non_windows_os():
> """lambda function to skip revprop_change test"""
> - return svntest.main.is_non_posix_os() and sys.platform != 'win32'
> + return (not svntest.main.is_posix_os()) and sys.platform != 'win32'
>
> # Helper functions
> def check_prop(name, path, exp_out):
> Index: subversion/tests/cmdline/commit_tests.py
> ===================================================================
> --- subversion/tests/cmdline/commit_tests.py (revision 25383)
> +++ subversion/tests/cmdline/commit_tests.py (working copy)
> @@ -25,6 +25,7 @@
>
> # (abbreviation)
> Skip = svntest.testcase.Skip
> +SkipUnless = svntest.testcase.SkipUnless
> XFail = svntest.testcase.XFail
> Item = svntest.wc.StateItem
>
> @@ -34,7 +35,7 @@
> #
>
> def is_non_posix_os_or_cygwin_platform():
> - return svntest.main.is_non_posix_os() or sys.platform == 'cygwin'
> + return (not svntest.main.is_posix_os()) or sys.platform == 'cygwin'
>
> def get_standard_state(wc_dir):
> """Return a status list reflecting the local mods made by
> Index: subversion/tests/cmdline/authz_tests.py
> ===================================================================
> --- subversion/tests/cmdline/authz_tests.py (revision 25383)
> +++ subversion/tests/cmdline/authz_tests.py (working copy)
> @@ -30,6 +30,7 @@
> Item = svntest.wc.StateItem
> XFail = svntest.testcase.XFail
> Skip = svntest.testcase.Skip
> +SkipUnless = svntest.testcase.SkipUnless
>
> ######################################################################
> # Tests
> @@ -815,9 +816,6 @@
> def authz_svnserve_anon_access_read(sbox):
> "authz issue #2712"
>
> - if not svntest.main.is_ra_type_svn():
> - raise svntest.Skip
> -
> sbox.build(create_wc = False)
> svntest.main.safe_rmtree(sbox.wc_dir)
> B_path = os.path.join(sbox.wc_dir, 'A', 'B')
> @@ -862,7 +860,8 @@
> authz_aliases,
> authz_validate,
> authz_locking,
> - authz_svnserve_anon_access_read,
> + SkipUnless(authz_svnserve_anon_access_read,
> + svntest.main.is_ra_type_svn),
> ]
>
> if __name__ == '__main__':
> Index: subversion/tests/cmdline/schedule_tests.py
> ===================================================================
> --- subversion/tests/cmdline/schedule_tests.py (revision 25383)
> +++ subversion/tests/cmdline/schedule_tests.py (working copy)
> @@ -26,6 +26,7 @@
>
> # (abbreviation)
> Skip = svntest.testcase.Skip
> +SkipUnless = svntest.testcase.SkipUnless
> XFail = svntest.testcase.XFail
> Item = svntest.wc.StateItem
>
> @@ -624,7 +625,7 @@
> revert_add_files,
> revert_add_directories,
> revert_nested_adds,
> - Skip(revert_add_executable, svntest.main.is_non_posix_os),
> + SkipUnless(revert_add_executable, svntest.main.is_posix_os),
> revert_delete_files,
> revert_delete_dirs,
> unschedule_missing_added,
> Index: subversion/tests/cmdline/svntest/testcase.py
> ===================================================================
> --- subversion/tests/cmdline/svntest/testcase.py (revision 25385)
> +++ subversion/tests/cmdline/svntest/testcase.py (working copy)
> @@ -157,7 +157,7 @@
>
>
> class Skip(TestCase):
> - """A test that will be skipped if condition COND is true."""
> + """A test that will be skipped if its conditional is true."""
>
> def __init__(self, test_case, cond_func=lambda:1):
> """Create an Skip instance based on TEST_CASE. COND_FUNC is a
> @@ -173,7 +173,7 @@
> self.test_case = create_test_case(test_case)
> self.cond_func = cond_func
> try:
> - if self.cond_func():
> + if self.conditional():
> self._list_mode_text = 'SKIP'
> except svntest.Failure:
> pass
> @@ -183,20 +183,36 @@
> self.convert_result = self.test_case.convert_result
>
> def need_sandbox(self):
> - if self.cond_func():
> + if self.conditional():
> return 0
> else:
> return self.test_case.need_sandbox()
>
> def run(self, sandbox=None):
> - if self.cond_func():
> + if self.conditional():
> raise svntest.Skip
> elif self.need_sandbox():
> return self.test_case.run(sandbox=sandbox)
> else:
> return self.test_case.run()
>
> + def conditional(self):
> + """Invoke SELF.cond_func(), and return the result evaluated
> + against the expected value."""
> + return self.cond_func()
>
> +
> +class SkipUnless(Skip):
> + """A test that will be skipped if its conditional is false."""
> +
> + def __init__(self, test_case, cond_func):
> + Skip.__init__(self, test_case, cond_func)
> +
> + def conditional(self):
> + "Return the negation of SELF.cond_func()."
> + return not self.cond_func()
> +
> +
> def create_test_case(func):
> if isinstance(func, TestCase):
> return func
> Index: subversion/tests/cmdline/svntest/main.py
> ===================================================================
> --- subversion/tests/cmdline/svntest/main.py (revision 25383)
> +++ subversion/tests/cmdline/svntest/main.py (working copy)
> @@ -667,8 +667,8 @@
> def is_os_windows():
> return (os.name == 'nt')
>
> -def is_non_posix_os():
> - return (os.name != 'posix')
> +def is_posix_os():
> + return (os.name == 'posix')
>
> ######################################################################
> # Sandbox handling
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jun 14 16:18:20 2007

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