<div dir="ltr">Hi Floris, <div><br></div><div>Sorry for the very long delay, but I wanted to follow this up, mainly just to say thank you for your reply, which was extremely helpful. You were right that I had not used fixtures appropriately and your fix of creating a fixture to produce channel objects works fine. </div>
<div><br></div><div>I'm still not sure whether my original code showed up a bug in py.test or not, I'm guessing probably not and the problem was at my end. However, if there's anything else I can do to help shed some light on it please let me know.</div>
<div><br></div><div>Regards,</div><div><br>Sarah</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 20, 2014 at 9:46 PM, Floris Bruynooghe <span dir="ltr"><<a href="mailto:flub@devork.be" target="_blank">flub@devork.be</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sarah,<br>
<br>
Apologies for not responding before, I wasn't really following this<br>
thread however Holger is away for a month hence the long silence I<br>
guess.<br>
<br>
I've used the zip and followed the instructions. As an example I've<br>
started with uncommenting testpoison and indeed as soon as uncommented<br>
py.test failed weirdly without any hint: while executing the test it<br>
just exited. I can't say exactly what is going on there and it<br>
probably is a bug that py.test just exists, but without narrowing it<br>
down it's hard to say why (and all the * imports make it hard to<br>
follow what's going on ;-)).<br>
<br>
However I assumed that this test was supposed to get a Channel<br>
instance from a fixture. Not finding any fixtures I changed the code<br>
to this:<br>
<br>
@pytest.fixture<br>
def chan():<br>
return Channel()<br>
<br>
@process<br>
def testpoinson(chan):<br>
print('Sending termination event...')<br>
chan.poison()<br>
return<br>
<br>
And now running the tests works just fine.<br>
<br>
Having the @process decorator on the test function is a bit odd<br>
however and I'm not sure how this behaves. It's probably better to<br>
try writing tests without a decorator. E.g. the following worked as<br>
well and looks much more reasonable to me (I'm just guessing here on<br>
the csp stuff btw, maybe I'm doing silly things):<br>
<br>
@pytest.fixture<br>
def chan():<br>
return Channel()<br>
<br>
def test_poinson(chan):<br>
@process<br>
def testpoison(chan):<br>
# chan = Channel()<br>
print('Sending termination event...')<br>
chan.poison()<br>
return<br>
ret = testpoison(chan)<br>
assert ret<br>
<br>
<br>
I don't really feel like I understand your problem, for example I feel<br>
like this test needs to assert something on the channel but I have no<br>
idea how/what (some process seems to be started anyway when I add<br>
``print ret; assert 0``). But maybe this was enough to give you some<br>
inspiration of how to prod things to start making some progress again.<br>
<br>
Regards,<br>
Floris<br>
<div><div class="h5"><br>
On 17 February 2014 09:16, Sarah Mount <<a href="mailto:mount.sarah@gmail.com">mount.sarah@gmail.com</a>> wrote:<br>
> Sorry to be a pain, I realise everyone here is a volunteer, but is there a<br>
> way to move this issue forward? I have quite a bit of work blocked on<br>
> getting py.test to work on my repo currently, and I'd rather use py.test<br>
> than any other framework. I'm more than happy to put in more effort to<br>
> narrow the bug down or take some of the next steps myself, but at this stage<br>
> I'm not really sure where to start...<br>
><br>
> Thanks,<br>
><br>
> Sarah<br>
><br>
><br>
> On Fri, Jan 24, 2014 at 9:35 AM, Sarah Mount <<a href="mailto:mount.sarah@gmail.com">mount.sarah@gmail.com</a>> wrote:<br>
>><br>
>> On 1/23/14, holger krekel <<a href="mailto:holger@merlinux.eu">holger@merlinux.eu</a>> wrote:<br>
>> > On Thu, Jan 23, 2014 at 18:27 +0000, Sarah Mount wrote:<br>
>> >> The tests were completely ad-hoc and did not use unittest or any other<br>
>> >> library. They had a hand-rolled runner which ran all the functions like<br>
>> >> test_one_one from a script.<br>
>> >><br>
>> >> The odd thing is that Python 2.7 + py.test + the functools.wraps<br>
>> >> version<br>
>> >> of<br>
>> >> the decorators worked OK.<br>
>> >><br>
>> >> Could it be that I have inadvertently turned the logging module on and<br>
>> >> output from that is confusing the py.test runner?<br>
>> ><br>
>> > wouldn't think so. Can you attach a zip file and state the dependencies<br>
>> > so we can try to reproduce? Or a repo-url?<br>
>> ><br>
>><br>
>> Many thanks, I am reluctant to give you a repo-url since there is so<br>
>> much code in there that is irrelevant to this issue it would be hard<br>
>> to figure out what is going on.<br>
>><br>
>> The attached zip contains the minimum code to reproduce. If you run<br>
>> "show_bug.sh" from the pytest-bug directory this will:<br>
>><br>
>> 1) install the requirements via pip,<br>
>><br>
>> 2) run a single test from vanilla python (should pass),<br>
>><br>
>> 3) run the same test with py.test (should green at this stage) and<br>
>><br>
>> 4) display some text explaining what to uncomment to reproduce the bug.<br>
>><br>
>> I have narrowed it down quite a bit, and it turns out that if you<br>
>> comment out most of the code in base.py everything works just fine...<br>
>> which is odd.<br>
>><br>
>> Thanks for your help,<br>
>><br>
>> Sarah<br>
>><br>
>> --<br>
>> Sarah Mount, Senior Lecturer, University of Wolverhampton<br>
>> website: <a href="http://www.snim2.org/" target="_blank">http://www.snim2.org/</a><br>
>> twitter: @snim2<br>
><br>
><br>
><br>
><br>
> --<br>
> Sarah Mount, Senior Lecturer, University of Wolverhampton<br>
> website: <a href="http://www.snim2.org/" target="_blank">http://www.snim2.org/</a><br>
> twitter: @snim2<br>
><br>
</div></div><div class="">> _______________________________________________<br>
> Pytest-dev mailing list<br>
> <a href="mailto:Pytest-dev@python.org">Pytest-dev@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/pytest-dev" target="_blank">https://mail.python.org/mailman/listinfo/pytest-dev</a><br>
><br>
<br>
<br>
<br>
--<br>
</div>Debian GNU/Linux -- The Power of Freedom<br>
<a href="http://www.debian.org" target="_blank">www.debian.org</a> | <a href="http://www.gnu.org" target="_blank">www.gnu.org</a> | <a href="http://www.kernel.org" target="_blank">www.kernel.org</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Sarah Mount, Senior Lecturer, University of Wolverhampton<br>website: <a href="http://www.snim2.org/" target="_blank">http://www.snim2.org/</a><br>twitter: @snim2
</div>