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

Re: Proposal: Use decorators in test suite for XFail, Skip, etc

From: Hyrum K Wright <hyrum_at_hyrumwright.org>
Date: Mon, 7 Feb 2011 13:35:11 +0000

On Mon, Feb 7, 2011 at 6:48 AM, Arwin Arni <arwin_at_collab.net> wrote:
> On Saturday 05 February 2011 01:46 AM, Hyrum K Wright wrote:
>>
>> On Fri, Feb 4, 2011 at 7:54 PM, C. Michael Pilato<cmpilato_at_collab.net>
>>  wrote:
>>>
>>> On 02/04/2011 02:09 PM, Greg Stein wrote:
>>>>
>>>> On Fri, Feb 4, 2011 at 12:15, Hyrum K Wright<hyrum_at_hyrumwright.org>
>>>>  wrote:
>>>>>
>>>>> ...
>>>>> We currently mark tests XFail (or Skip, or something else) by wrapping
>>>>> them in the test_list in the test suite.  Rather than doing it there,
>>>>> I think it makes more sense to use Python's decorator syntax to mark
>>>>> tests as XFail right at their definition, rather than down in the test
>>>>> list.  Keeping all attributes of a test in close proximity is a Good
>>>>> Thing, imo.  Attached is a patch which demonstrates this.
>>>>
>>>> Sure.
>>>>
>>>>> ...
>>>>> +++ subversion/tests/cmdline/basic_tests.py     (working copy)
>>>>
>>>> XFail = svntest.testcase.xfail_deco
>>>>
>>>>> @@ -1961,6 +1961,7 @@
>>>>>                                         expected_status)
>>>>>
>>>>>  # Test for issue #1199
>>>>> +@svntest.testcase.xfail_deco
>>>>
>>>> @XFail
>>>
>>> Oh yes.  Much, much nicer to read.
>>
>> Pilot committed in r1067273.  That rev only changes basic_tests.py; I
>> plan to hit the others shortly.
>>
>> -Hyrum
>
> I don't know much about Python decorators, but what if I have a test that
> does two things (like XFail and SkipUnless), do we have two decorators at
> the definition?

Just use them both. Order *shouldn't* matter. (I think.)

-Hyrum
Received on 2011-02-07 14:35:50 CET

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.