You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Philip Martin <ph...@wandisco.com> on 2011/02/07 14:34:37 UTC

Re: svn commit: r1067380 [1/3] - in /subversion/trunk/subversion/tests/cmdline: ./ svntest/

hwright@apache.org writes:

> Author: hwright
> Date: Sat Feb  5 02:17:32 2011
> New Revision: 1067380
>
> URL: http://svn.apache.org/viewvc?rev=1067380&view=rev
> Log:
> Use Python decorators to denote XFail, Skip, SkipUnless and Wimp tests.  Also,
> add Issue decorators where appropriate.

authz_tests.py defines two tests: wc_wc_copy and wc_wc_copy_revert, and
the second test calls the first:

  @Skip(svntest.main.is_ra_type_file)
  def wc_wc_copy(sbox):
    "wc-to-wc copy with absent nodes"
    ...

  @Skip(svntest.main.is_ra_type_file)
  def wc_wc_copy_revert(sbox):
    "wc-to-wc copy with absent nodes and then revert"

    wc_wc_copy(sbox)
    ...

and this now fails with:

  File "/home/pm/sw/subversion/src/subversion/tests/cmdline/authz_tests.py", lin
e 1049, in wc_wc_copy_revert
    wc_wc_copy(sbox)
AttributeError: _Skip instance has no __call__ method

-- 
Philip

Re: svn commit: r1067380 [1/3] - in /subversion/trunk/subversion/tests/cmdline: ./ svntest/

Posted by Philip Martin <ph...@wandisco.com>.
> I haven't tested it, but the Right solution feels like we should make
> the tests not call each other.  Either they should be combined into
> one test, or the common code should be factored out into a helper
> method.  What benefit does having the called test give, if the *exact*
> same code is being tested elsewhere?

I suppose they could be combined now.  When originally written the first
test, a copy, passed but second test, the same copy followed by a
revert, failed.  If I used just used one test then it would have been an
XFAIL and the working operation could have broken without triggering an
additional FAIL.

-- 
Philip

Re: svn commit: r1067380 [1/3] - in /subversion/trunk/subversion/tests/cmdline: ./ svntest/

Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Mon, Feb 7, 2011 at 1:49 PM, Philip Martin
<ph...@wandisco.com> wrote:
> Philip Martin <ph...@wandisco.com> writes:
>
>> hwright@apache.org writes:
>>
>>> Author: hwright
>>> Date: Sat Feb  5 02:17:32 2011
>>> New Revision: 1067380
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1067380&view=rev
>>> Log:
>>> Use Python decorators to denote XFail, Skip, SkipUnless and Wimp tests.  Also,
>>> add Issue decorators where appropriate.
>>
>> authz_tests.py defines two tests: wc_wc_copy and wc_wc_copy_revert, and
>> the second test calls the first:
>>
>>   @Skip(svntest.main.is_ra_type_file)
>>   def wc_wc_copy(sbox):
>>     "wc-to-wc copy with absent nodes"
>>     ...
>>
>>   @Skip(svntest.main.is_ra_type_file)
>>   def wc_wc_copy_revert(sbox):
>>     "wc-to-wc copy with absent nodes and then revert"
>>
>>     wc_wc_copy(sbox)
>>     ...
>>
>> and this now fails with:
>>
>>   File "/home/pm/sw/subversion/src/subversion/tests/cmdline/authz_tests.py", lin
>> e 1049, in wc_wc_copy_revert
>>     wc_wc_copy(sbox)
>> AttributeError: _Skip instance has no __call__ method
>
> Is this right?
>
> Index: subversion/tests/cmdline/svntest/testcase.py
> ===================================================================
> --- subversion/tests/cmdline/svntest/testcase.py        (revision 1067926)
> +++ subversion/tests/cmdline/svntest/testcase.py        (working copy)
> @@ -259,6 +259,8 @@
>       raise svntest.Skip
>     return self._delegate.run(sandbox)
>
> +  def __call__(self, *args):
> +    return self.run(*args)
>
>  class _SkipUnless(_Skip):
>   """A test that will be skipped if its conditional is false."""

I haven't tested it, but the Right solution feels like we should make
the tests not call each other.  Either they should be combined into
one test, or the common code should be factored out into a helper
method.  What benefit does having the called test give, if the *exact*
same code is being tested elsewhere?

-Hyrum

Re: svn commit: r1067380 [1/3] - in /subversion/trunk/subversion/tests/cmdline: ./ svntest/

Posted by Philip Martin <ph...@wandisco.com>.
Philip Martin <ph...@wandisco.com> writes:

> hwright@apache.org writes:
>
>> Author: hwright
>> Date: Sat Feb  5 02:17:32 2011
>> New Revision: 1067380
>>
>> URL: http://svn.apache.org/viewvc?rev=1067380&view=rev
>> Log:
>> Use Python decorators to denote XFail, Skip, SkipUnless and Wimp tests.  Also,
>> add Issue decorators where appropriate.
>
> authz_tests.py defines two tests: wc_wc_copy and wc_wc_copy_revert, and
> the second test calls the first:
>
>   @Skip(svntest.main.is_ra_type_file)
>   def wc_wc_copy(sbox):
>     "wc-to-wc copy with absent nodes"
>     ...
>
>   @Skip(svntest.main.is_ra_type_file)
>   def wc_wc_copy_revert(sbox):
>     "wc-to-wc copy with absent nodes and then revert"
>
>     wc_wc_copy(sbox)
>     ...
>
> and this now fails with:
>
>   File "/home/pm/sw/subversion/src/subversion/tests/cmdline/authz_tests.py", lin
> e 1049, in wc_wc_copy_revert
>     wc_wc_copy(sbox)
> AttributeError: _Skip instance has no __call__ method

Is this right?

Index: subversion/tests/cmdline/svntest/testcase.py
===================================================================
--- subversion/tests/cmdline/svntest/testcase.py	(revision 1067926)
+++ subversion/tests/cmdline/svntest/testcase.py	(working copy)
@@ -259,6 +259,8 @@
       raise svntest.Skip
     return self._delegate.run(sandbox)
 
+  def __call__(self, *args):
+    return self.run(*args)
 
 class _SkipUnless(_Skip):
   """A test that will be skipped if its conditional is false."""

-- 
Philip