Multiprocessing Problem With Generators And Decorators

98 views
Skip to first unread message

Daniel Watkins

unread,
Apr 11, 2012, 12:30:12 PM4/11/12
to nose-...@googlegroups.com
Hello all,

I am writing some tests which we need to run several times against different targets (we're writing Selenium tests, and we want to run exactly the same test against different browsers).  I have been doing this using decorators, and it's been working nicely (see https://gist.github.com/2360312 for a simplified example).  If you drop that file in a directory and run nosetests, you'll get three successful tests.

However, when I try and run the tests in parallel (or even with --processes=1), I get the following traceback for each test:

======================================================================
ERROR: Failure: ValueError (No such test wrap)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/daniel/.virtualenvs/sfw_testing/lib/python2.6/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_class(self.exc_val)
ValueError: No such test wrap

This suggests that nose is passing around the name of the function to be called rather than the callable itself.  Can anyone suggest how to go about fixing this?


Thanks,

Dan

jason pellerin

unread,
Apr 14, 2012, 8:38:25 PM4/14/12
to nose-...@googlegroups.com
That's correct, nose does only pass the name of the test to the runner
process -- test cases are not necessarily pickleable, so passing the
actual test isn't possible. What's happening here sounds like a
decorator that's returning a new function, but not setting it up
properly to look like the function it is wrapping/replacing.
functools.wraps is good for that, if you're on a recent enough version
of python. nose.tools has a similar function for older pythons,
make_decorator.

JP

> --
> You received this message because you are subscribed to the Google Groups
> "nose-users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nose-users/-/nuTwq9KnJNQJ.
> To post to this group, send email to nose-...@googlegroups.com.
> To unsubscribe from this group, send email to
> nose-users+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/nose-users?hl=en.

Reply all
Reply to author
Forward
0 new messages