Thanks, should I be able to safely pickle a test instance?  It seems to be working mostly ok, except on deserialization I&#39;m getting:<div><br></div><div><div>Traceback (most recent call last):</div><div>  File &quot;/home/alex/ans/web/lib/a/test/__init__.py&quot;, line 311, in execute_test</div>
<div>    a.lib.execute_on_cpython(run_test_proxy)(test)</div><div>  File &quot;/home/alex/ans/web/lib/a/lib.py&quot;, line 1137, in wrapper</div><div>    return pickle.loads(channel.receive())</div><div>  File &quot;/home/alex/ans/venv/lib/pypy/site-packages/execnet/gateway_base.py&quot;, line 413, in receive</div>
<div>    raise self._getremoteerror() or EOFError()</div><div>RemoteError: Traceback (most recent call last):</div><div>  File &quot;/home/alex/ans/venv/lib/pypy/site-packages/execnet/gateway_base.py&quot;, line 735, in executetask</div>
<div>    function(channel, **kwargs)</div><div>  File &quot;&quot;, line 10, in cpython_runner</div><div>  File &quot;/home/alex/ans/venv/lib/python2.6/pickle.py&quot;, line 1374, in loads</div><div>    return Unpickler(file).load()</div>
<div>  File &quot;/home/alex/ans/venv/lib/python2.6/pickle.py&quot;, line 858, in load</div><div>    dispatch[key](self)</div><div>  File &quot;/home/alex/ans/venv/lib/python2.6/pickle.py&quot;, line 1217, in load_build</div>
<div>    setstate(state)</div><div>  File &quot;/home/alex/ans/venv/lib/pypy/site-packages/nose/config.py&quot;, line 238, in __setstate__</div><div>    self.plugins.configure(self.options, self)</div><div>  File &quot;/home/alex/ans/venv/lib/pypy/site-packages/nose/plugins/manager.py&quot;, line 271, in configure</div>
<div>    cfg(options, config)</div><div>  File &quot;/home/alex/ans/venv/lib/pypy/site-packages/nose/plugins/manager.py&quot;, line 94, in __call__</div><div>    return self.call(*arg, **kw)</div><div>  File &quot;/home/alex/ans/venv/lib/pypy/site-packages/nose/plugins/manager.py&quot;, line 162, in simple</div>
<div>    result = meth(*arg, **kw)</div><div>  File &quot;/home/alex/ans/venv/lib/pypy/site-packages/nose/plugins/prof.py&quot;, line 76, in configure</div><div>    if options.profile_stats_file:</div><div>AttributeError: Values instance has no attribute &#39;profile_stats_file&#39;</div>
<div><br></div><div><br></div><div>Any idea what&#39;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">&lt;<a href="mailto:jpellerin@gmail.com">jpellerin@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I&#39;m away from my main computer right now so I can&#39;t give very good<br>
examples but here&#39;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&#39;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 &lt;<a href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>&gt; wrote:<br>
&gt; Sorry, I should have been more clear, I understand it&#39;s supposed to return a<br>
&gt; callable, I just need to understand what exactly that callable is supposed<br>
&gt; to do, essentially, is there an example of what the &quot;default&quot;<br>
&gt; prepareTestCase does?  Also, returning None simply triggers the default<br>
&gt; behavior, right?<br>
&gt; Alex<br>
&gt;<br>
&gt; On Wed, Jul 20, 2011 at 10:33 PM, Kumar McMillan &lt;<a href="mailto:kumar.mcmillan@gmail.com">kumar.mcmillan@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Wed, Jul 20, 2011 at 11:46 PM, Alex Gaynor &lt;<a href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; Err, are there any docs with an example of what prepareTestCase should<br>
&gt;&gt; &gt; return?<br>
&gt;&gt;<br>
&gt;&gt; Hi Alex.  prepareTestCase just needs to return a callable.  When<br>
&gt;&gt; called, it runs the test.  You can also look at nose.case.Test.  A<br>
&gt;&gt; subclass of that would be an adequate return value.<br>
&gt;&gt;<br>
&gt;&gt; As an aside, you may want to check out nosepipe, a plugin that<br>
&gt;&gt; collects tests then runs each one in a subprocess:<br>
&gt;&gt; <a href="http://pypi.python.org/pypi/nosepipe/" target="_blank">http://pypi.python.org/pypi/nosepipe/</a>  It&#39;s not an elegant solution to<br>
&gt;&gt; what you&#39;re after but probably implements a lot of the same hooks.<br>
&gt;&gt;<br>
&gt;&gt; -Kumar<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; &gt; Thanks,<br>
&gt;&gt; &gt; Alex<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Wed, Jul 20, 2011 at 9:16 PM, Alex Gaynor &lt;<a href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Synchronous, normal style is totally fine, so it looks like<br>
&gt;&gt; &gt;&gt; prepareTestCase is the right call.  Thanks.<br>
&gt;&gt; &gt;&gt; Alex<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Wed, Jul 20, 2011 at 6:32 PM, jason pellerin &lt;<a href="mailto:jpellerin@gmail.com">jpellerin@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; That&#39;s a fun one. Do you want to wait for cpython to execute each<br>
&gt;&gt; &gt;&gt;&gt; test, or send a bunch of tests over to process/process pool and<br>
&gt;&gt; &gt;&gt;&gt; collect the results later?<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; The wait case is not so hard -- you can write a plugin that implements<br>
&gt;&gt; &gt;&gt;&gt; prepareTestCase* to wrap the test in the cpythonizing machinery, run<br>
&gt;&gt; &gt;&gt;&gt; it, and report the result.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; The queue and collect case is sort of a special case of<br>
&gt;&gt; &gt;&gt;&gt; multiprocessing which requires writing a new test runner and is<br>
&gt;&gt; &gt;&gt;&gt; harder. But basically you write whatever test runner you want and use<br>
&gt;&gt; &gt;&gt;&gt; the prepareTestRunner** plugin hook to inject it.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; Also we really need to add pypy to our tox config, Kumar. ;)<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; JP<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; *<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;  <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>

&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; **<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; <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>

&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; On Wed, Jul 20, 2011 at 9:15 PM, Alex Gaynor &lt;<a href="mailto:alex.gaynor@gmail.com">alex.gaynor@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt;&gt; &gt; Hi all,<br>
&gt;&gt; &gt;&gt;&gt; &gt; I&#39;ve got a fair insane question about nose.  I&#39;d like to be able to<br>
&gt;&gt; &gt;&gt;&gt; &gt; control<br>
&gt;&gt; &gt;&gt;&gt; &gt; how my nose tests are executed, specifically I&#39;m running my suite<br>
&gt;&gt; &gt;&gt;&gt; &gt; under<br>
&gt;&gt; &gt;&gt;&gt; &gt; PyPy, but I&#39;d like certain tests (in their entirety, setup, test,<br>
&gt;&gt; &gt;&gt;&gt; &gt; teardown)<br>
&gt;&gt; &gt;&gt;&gt; &gt; to be executed on CPython.  I have the machinery to send some code<br>
&gt;&gt; &gt;&gt;&gt; &gt; over<br>
&gt;&gt; &gt;&gt;&gt; &gt; to<br>
&gt;&gt; &gt;&gt;&gt; &gt; CPython to execute it, but what I&#39;m missing is the ability to do<br>
&gt;&gt; &gt;&gt;&gt; &gt; that<br>
&gt;&gt; &gt;&gt;&gt; &gt; over<br>
&gt;&gt; &gt;&gt;&gt; &gt; the entirety of a test run.  In py.test I believe this could be<br>
&gt;&gt; &gt;&gt;&gt; &gt; accomplished<br>
&gt;&gt; &gt;&gt;&gt; &gt; with a custom test collector.<br>
&gt;&gt; &gt;&gt;&gt; &gt; Thanks,<br>
&gt;&gt; &gt;&gt;&gt; &gt; Alex<br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; --<br>
&gt;&gt; &gt;&gt;&gt; &gt; &quot;I disapprove of what you say, but I will defend to the death your<br>
&gt;&gt; &gt;&gt;&gt; &gt; right to<br>
&gt;&gt; &gt;&gt;&gt; &gt; say it.&quot; -- Evelyn Beatrice Hall (summarizing Voltaire)<br>
&gt;&gt; &gt;&gt;&gt; &gt; &quot;The people&#39;s good is the highest law.&quot; -- Cicero<br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt;&gt;&gt; &gt; testing-in-python mailing list<br>
&gt;&gt; &gt;&gt;&gt; &gt; <a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
&gt;&gt; &gt;&gt;&gt; &gt; <a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; &quot;I disapprove of what you say, but I will defend to the death your<br>
&gt;&gt; &gt;&gt; right<br>
&gt;&gt; &gt;&gt; to say it.&quot; -- Evelyn Beatrice Hall (summarizing Voltaire)<br>
&gt;&gt; &gt;&gt; &quot;The people&#39;s good is the highest law.&quot; -- Cicero<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; &quot;I disapprove of what you say, but I will defend to the death your right<br>
&gt;&gt; &gt; to<br>
&gt;&gt; &gt; say it.&quot; -- Evelyn Beatrice Hall (summarizing Voltaire)<br>
&gt;&gt; &gt; &quot;The people&#39;s good is the highest law.&quot; -- Cicero<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; testing-in-python mailing list<br>
&gt;&gt; &gt; <a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
&gt;&gt; &gt; <a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; &quot;I disapprove of what you say, but I will defend to the death your right to<br>
&gt; say it.&quot; -- Evelyn Beatrice Hall (summarizing Voltaire)<br>
&gt; &quot;The people&#39;s good is the highest law.&quot; -- Cicero<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>&quot;I disapprove of what you say, but I will defend to the death your right to say it.&quot; -- Evelyn Beatrice Hall (summarizing Voltaire)<br>&quot;The people&#39;s good is the highest law.&quot; -- Cicero<br>
<br>
</div>