[Webkit-unassigned] [Bug 48614] webkitpy.layout_tests.run_webkit_tests_unittest.MainTest gets wedged on Windows XP/Cygwin 1.5/Python 2.5.2

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 2 13:12:36 PDT 2010


--- Comment #22 from Adam Roben (aroben) <aroben at apple.com>  2010-11-02 13:12:36 PST ---
(In reply to comment #19)
> (In reply to comment #18)
> > (From update of attachment 72671 [details] [details])
> > I assume the decorator looks different because it is a class decorator.
> What does the class decorator syntax look like?  I wonder if we want a class decorator or just function decorators like unittest seems to have?

Class decorator syntax looks just like method decorator syntax, except you put it above a class declaration instead of a method declaration:

class MyClass:

You can see an example in <http://docs.python.org/library/unittest.html#skipping-tests-and-expected-failures> where it says "Classes can be skipped just like methods:"

> > >> WebKitTools/Scripts/webkitpy/test/skip_unittest.py:59
> > >> +        return TestSkipFixture
> > > 
> > > I'm confused why not just declare this at the top of the file?  Creating it dynamically in this method doesn't make much sense to me?
> > 
> > The decorator modifies the class itself. Since we want to test skip_if twice (once with True and once with False) we need to have two different classes so that the tests don't interfere with each other. Maybe I should have added a comment.
> Yeah, I'm just not sure what a "class decorator" looks like, and I'm not sure we want one over method decorators.

Hopefully the above information will help you.

> We could basically write our own wkunittest.py module, and then use things like this via:
> @wkunittest.skipIf(condition)

Sure, that sounds fine.

> I think it would be *super awesome* to be able to use more of the new skip* stuff from unittest, so I'm glad you've started us down that path.  I just think we should try to be as much like the stuff coming in python 2.7 instead of inventing our own syntax.


> > >> WebKitTools/Scripts/webkitpy/test/skip_unittest.py:65
> > >> +        klass = skip_if(self.create_fixture_class(), False, 'Should not see this message.', logger=self.logger)
> > > 
> > > Would have been nice to see an example of it using the decorator syntax.
> > 
> > My understanding is that class decorator syntax wasn't added until Python 2.6.
> http://trac.webkit.org/browser/trunk/WebKitTools/Scripts/webkitpy/common/memoized.py
> seems to work with 2.5. :)

memoized is a method decorator, not a class decorator.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list