[TIP] Custom execution of nose tests

Kumar McMillan kumar.mcmillan at gmail.com
Wed Jul 20 22:33:32 PDT 2011


On Wed, Jul 20, 2011 at 11:46 PM, Alex Gaynor <alex.gaynor at gmail.com> wrote:
> Err, are there any docs with an example of what prepareTestCase should
> return?

Hi Alex.  prepareTestCase just needs to return a callable.  When
called, it runs the test.  You can also look at nose.case.Test.  A
subclass of that would be an adequate return value.

As an aside, you may want to check out nosepipe, a plugin that
collects tests then runs each one in a subprocess:
http://pypi.python.org/pypi/nosepipe/  It's not an elegant solution to
what you're after but probably implements a lot of the same hooks.

-Kumar


> Thanks,
> Alex
>
> On Wed, Jul 20, 2011 at 9:16 PM, Alex Gaynor <alex.gaynor at gmail.com> wrote:
>>
>> Synchronous, normal style is totally fine, so it looks like
>> prepareTestCase is the right call.  Thanks.
>> Alex
>>
>> On Wed, Jul 20, 2011 at 6:32 PM, jason pellerin <jpellerin at gmail.com>
>> wrote:
>>>
>>> That's a fun one. Do you want to wait for cpython to execute each
>>> test, or send a bunch of tests over to process/process pool and
>>> collect the results later?
>>>
>>> The wait case is not so hard -- you can write a plugin that implements
>>> prepareTestCase* to wrap the test in the cpythonizing machinery, run
>>> it, and report the result.
>>>
>>> The queue and collect case is sort of a special case of
>>> multiprocessing which requires writing a new test runner and is
>>> harder. But basically you write whatever test runner you want and use
>>> the prepareTestRunner** plugin hook to inject it.
>>>
>>> Also we really need to add pypy to our tox config, Kumar. ;)
>>>
>>> JP
>>>
>>> *
>>>  http://packages.python.org/nose/plugins/interface.html#nose.plugins.base.IPluginInterface.prepareTestCase
>>>
>>> **
>>>
>>> http://packages.python.org/nose/plugins/interface.html#nose.plugins.base.IPluginInterface.prepareTestRunner
>>>
>>> On Wed, Jul 20, 2011 at 9:15 PM, Alex Gaynor <alex.gaynor at gmail.com>
>>> wrote:
>>> > Hi all,
>>> > I've got a fair insane question about nose.  I'd like to be able to
>>> > control
>>> > how my nose tests are executed, specifically I'm running my suite under
>>> > PyPy, but I'd like certain tests (in their entirety, setup, test,
>>> > teardown)
>>> > to be executed on CPython.  I have the machinery to send some code over
>>> > to
>>> > CPython to execute it, but what I'm missing is the ability to do that
>>> > over
>>> > the entirety of a test run.  In py.test I believe this could be
>>> > accomplished
>>> > with a custom test collector.
>>> > Thanks,
>>> > Alex
>>> >
>>> > --
>>> > "I disapprove of what you say, but I will defend to the death your
>>> > right to
>>> > say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
>>> > "The people's good is the highest law." -- Cicero
>>> >
>>> >
>>> > _______________________________________________
>>> > testing-in-python mailing list
>>> > testing-in-python at lists.idyll.org
>>> > http://lists.idyll.org/listinfo/testing-in-python
>>> >
>>> >
>>
>>
>>
>> --
>> "I disapprove of what you say, but I will defend to the death your right
>> to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
>> "The people's good is the highest law." -- Cicero
>>
>
>
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
> "The people's good is the highest law." -- Cicero
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>
>



More information about the testing-in-python mailing list