Thanks, should I be able to safely pickle a test instance? It seems to be working mostly ok, except on deserialization I'm getting:<div><br></div><div><div>Traceback (most recent call last):</div><div> File "/home/alex/ans/web/lib/a/test/__init__.py", line 311, in execute_test</div>
<div> a.lib.execute_on_cpython(run_test_proxy)(test)</div><div> File "/home/alex/ans/web/lib/a/lib.py", line 1137, in wrapper</div><div> return pickle.loads(channel.receive())</div><div> File "/home/alex/ans/venv/lib/pypy/site-packages/execnet/gateway_base.py", line 413, in receive</div>
<div> raise self._getremoteerror() or EOFError()</div><div>RemoteError: Traceback (most recent call last):</div><div> File "/home/alex/ans/venv/lib/pypy/site-packages/execnet/gateway_base.py", line 735, in executetask</div>
<div> function(channel, **kwargs)</div><div> File "", line 10, in cpython_runner</div><div> File "/home/alex/ans/venv/lib/python2.6/pickle.py", line 1374, in loads</div><div> return Unpickler(file).load()</div>
<div> File "/home/alex/ans/venv/lib/python2.6/pickle.py", line 858, in load</div><div> dispatch[key](self)</div><div> File "/home/alex/ans/venv/lib/python2.6/pickle.py", line 1217, in load_build</div>
<div> setstate(state)</div><div> File "/home/alex/ans/venv/lib/pypy/site-packages/nose/config.py", line 238, in __setstate__</div><div> self.plugins.configure(self.options, self)</div><div> File "/home/alex/ans/venv/lib/pypy/site-packages/nose/plugins/manager.py", line 271, in configure</div>
<div> cfg(options, config)</div><div> File "/home/alex/ans/venv/lib/pypy/site-packages/nose/plugins/manager.py", line 94, in __call__</div><div> return self.call(*arg, **kw)</div><div> File "/home/alex/ans/venv/lib/pypy/site-packages/nose/plugins/manager.py", line 162, in simple</div>
<div> result = meth(*arg, **kw)</div><div> File "/home/alex/ans/venv/lib/pypy/site-packages/nose/plugins/prof.py", line 76, in configure</div><div> if options.profile_stats_file:</div><div>AttributeError: Values instance has no attribute 'profile_stats_file'</div>
<div><br></div><div><br></div><div>Any idea what's up with this?</div><div>Alex</div><br><div class="gmail_quote">On Thu, Jul 21, 2011 at 11:07 AM, jason pellerin <span dir="ltr"><<a href="mailto:jpellerin@gmail.com">jpellerin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I'm away from my main computer right now so I can't give very good<br>
examples but here's a poor one:<br>
<br>
<a href="http://packages.python.org/nose/plugins/collect.html" target="_blank">http://packages.python.org/nose/plugins/collect.html</a> (scroll down to<br>
the plugin source; poor because most plugins won't have to worry about<br>
making plugin calls themselves like that one does).<br>
<br>
Basically, prepareTestCase gets a nose.case.Test and you can twiddle<br>
that (or not) and return None, or return a callable that will be<br>
called with the test result and can do whatever it wants and use that<br>
result to record the outcome.<br>
<font color="#888888"><br>
JP<br>
</font><div><div></div><div class="h5"><br>
On Thu, Jul 21, 2011 at 1:55 PM, Alex Gaynor <<a href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>> wrote:<br>
> Sorry, I should have been more clear, I understand it's supposed to return a<br>
> callable, I just need to understand what exactly that callable is supposed<br>
> to do, essentially, is there an example of what the "default"<br>
> prepareTestCase does? Also, returning None simply triggers the default<br>
> behavior, right?<br>
> Alex<br>
><br>
> On Wed, Jul 20, 2011 at 10:33 PM, Kumar McMillan <<a href="mailto:kumar.mcmillan@gmail.com">kumar.mcmillan@gmail.com</a>><br>
> wrote:<br>
>><br>
>> On Wed, Jul 20, 2011 at 11:46 PM, Alex Gaynor <<a href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>><br>
>> wrote:<br>
>> > Err, are there any docs with an example of what prepareTestCase should<br>
>> > return?<br>
>><br>
>> Hi Alex. prepareTestCase just needs to return a callable. When<br>
>> called, it runs the test. You can also look at nose.case.Test. A<br>
>> subclass of that would be an adequate return value.<br>
>><br>
>> As an aside, you may want to check out nosepipe, a plugin that<br>
>> collects tests then runs each one in a subprocess:<br>
>> <a href="http://pypi.python.org/pypi/nosepipe/" target="_blank">http://pypi.python.org/pypi/nosepipe/</a> It's not an elegant solution to<br>
>> what you're after but probably implements a lot of the same hooks.<br>
>><br>
>> -Kumar<br>
>><br>
>><br>
>> > Thanks,<br>
>> > Alex<br>
>> ><br>
>> > On Wed, Jul 20, 2011 at 9:16 PM, Alex Gaynor <<a href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Synchronous, normal style is totally fine, so it looks like<br>
>> >> prepareTestCase is the right call. Thanks.<br>
>> >> Alex<br>
>> >><br>
>> >> On Wed, Jul 20, 2011 at 6:32 PM, jason pellerin <<a href="mailto:jpellerin@gmail.com">jpellerin@gmail.com</a>><br>
>> >> wrote:<br>
>> >>><br>
>> >>> That's a fun one. Do you want to wait for cpython to execute each<br>
>> >>> test, or send a bunch of tests over to process/process pool and<br>
>> >>> collect the results later?<br>
>> >>><br>
>> >>> The wait case is not so hard -- you can write a plugin that implements<br>
>> >>> prepareTestCase* to wrap the test in the cpythonizing machinery, run<br>
>> >>> it, and report the result.<br>
>> >>><br>
>> >>> The queue and collect case is sort of a special case of<br>
>> >>> multiprocessing which requires writing a new test runner and is<br>
>> >>> harder. But basically you write whatever test runner you want and use<br>
>> >>> the prepareTestRunner** plugin hook to inject it.<br>
>> >>><br>
>> >>> Also we really need to add pypy to our tox config, Kumar. ;)<br>
>> >>><br>
>> >>> JP<br>
>> >>><br>
>> >>> *<br>
>> >>><br>
>> >>> <a href="http://packages.python.org/nose/plugins/interface.html#nose.plugins.base.IPluginInterface.prepareTestCase" target="_blank">http://packages.python.org/nose/plugins/interface.html#nose.plugins.base.IPluginInterface.prepareTestCase</a><br>
>> >>><br>
>> >>> **<br>
>> >>><br>
>> >>><br>
>> >>> <a href="http://packages.python.org/nose/plugins/interface.html#nose.plugins.base.IPluginInterface.prepareTestRunner" target="_blank">http://packages.python.org/nose/plugins/interface.html#nose.plugins.base.IPluginInterface.prepareTestRunner</a><br>
>> >>><br>
>> >>> On Wed, Jul 20, 2011 at 9:15 PM, Alex Gaynor <<a href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>><br>
>> >>> wrote:<br>
>> >>> > Hi all,<br>
>> >>> > I've got a fair insane question about nose. I'd like to be able to<br>
>> >>> > control<br>
>> >>> > how my nose tests are executed, specifically I'm running my suite<br>
>> >>> > under<br>
>> >>> > PyPy, but I'd like certain tests (in their entirety, setup, test,<br>
>> >>> > teardown)<br>
>> >>> > to be executed on CPython. I have the machinery to send some code<br>
>> >>> > over<br>
>> >>> > to<br>
>> >>> > CPython to execute it, but what I'm missing is the ability to do<br>
>> >>> > that<br>
>> >>> > over<br>
>> >>> > the entirety of a test run. In py.test I believe this could be<br>
>> >>> > accomplished<br>
>> >>> > with a custom test collector.<br>
>> >>> > Thanks,<br>
>> >>> > Alex<br>
>> >>> ><br>
>> >>> > --<br>
>> >>> > "I disapprove of what you say, but I will defend to the death your<br>
>> >>> > right to<br>
>> >>> > say it." -- Evelyn Beatrice Hall (summarizing Voltaire)<br>
>> >>> > "The people's good is the highest law." -- Cicero<br>
>> >>> ><br>
>> >>> ><br>
>> >>> > _______________________________________________<br>
>> >>> > testing-in-python mailing list<br>
>> >>> > <a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
>> >>> > <a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
>> >>> ><br>
>> >>> ><br>
>> >><br>
>> >><br>
>> >><br>
>> >> --<br>
>> >> "I disapprove of what you say, but I will defend to the death your<br>
>> >> right<br>
>> >> to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)<br>
>> >> "The people's good is the highest law." -- Cicero<br>
>> >><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > "I disapprove of what you say, but I will defend to the death your right<br>
>> > to<br>
>> > say it." -- Evelyn Beatrice Hall (summarizing Voltaire)<br>
>> > "The people's good is the highest law." -- Cicero<br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > testing-in-python mailing list<br>
>> > <a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
>> > <a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
>> ><br>
>> ><br>
><br>
><br>
><br>
> --<br>
> "I disapprove of what you say, but I will defend to the death your right to<br>
> say it." -- Evelyn Beatrice Hall (summarizing Voltaire)<br>
> "The people's good is the highest law." -- Cicero<br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire)<br>"The people's good is the highest law." -- Cicero<br>
<br>
</div>