[py-dev] migration from 1.3 to 2.0

Vyacheslav Rafalskiy rafalskiy at gmail.com
Wed Apr 6 23:00:59 CEST 2011


>>> 3. In my pytest_configure() there are numerous conditions when it can
>>> fail. For this
>>> conditions I have exceptions with specially crafted messages, intended
>>> for different
>>> people. Now they are gone, replaced by a long and scary listing with every line
>>> prepended with INTERNALERROR. What is internal about it? Can I continue managing
>>> my configuration errors?
>>
>> Sure, you should be able to. I guess it was a bit of an incident that
>> failures in pytest_configure were shown nicely.  I am not quite sure
>> immediately what the best way to relay "global" configuration messages
>> to the user is.  If you'd use "funcargs" and the "session" scope for
>> setting up resources then it would show nicely.  Feel free to open
>> a feature/enhancement request to have py.test show failures
>> in sessionstart or configure hooks in a way that helps you.
>> This way we can write a specific test and make sure it works
>> also in the future.
>
> If I understand correctly, using funcargs means that every test function
> of hundreds I have in several suites should include a reference to the
> global setup funcarg. It seems a non-starter.
>
> I guess I will stick to the old version and try to think of something
>  to enter in a feature request.
>
> Vyacheslav
>

Looks like I solved my main problem with a monkey patch, admittedly a brutal one

import sys
import _pytest.core

def notify_exception(self, excinfo):
    excrepr = excinfo.getrepr(style='native')
    sys.stderr.write(excrepr)

_pytest.core.PluginManager.notify_exception = notify_exception



More information about the Pytest-dev mailing list