Open ThrashAbaddon opened 5 years ago
im under the impression the lookup for warnings class of gtk desnt work as normal warning lookup - im not sure how to debug this one
Maybe I can do it for you. How do you do it for other classes?
off hand no idea, @nicoddemus took charge of warning serialization, and that bit had a fair share of issues due to strangeness in the warning system ^^, also im basically just on the computer to call in sick, i'll hit the bed soon
Uh, hope you get better soon.
I don't care about the gtk warnings so I'll try my luck with warnings module but I'm not sure what hook
to use in conftest.py
. Maybe
import warnings
warnings.filterwarnings("ignore")
inside pytest_sessionstart?
@ThrashAbaddon ignoring the warning like that should work. Please report back with any findings. π
This works so @RonnyPfannschmidt thanks for the hint. :)
The solution was to add in my conftest.py
following code:
import warnings
def pytest_sessionstart(session):
warnings.filterwarnings("ignore")
Also, as GTK is popular gui framework I would like to have pytest working out of the box with GTKWarnings, or have a detailed explanation and workaround in official documentation. What do you guys think?
What do you guys think?
It sounds good. The first step, I think, would be to understand if there's any "magic" being done by GTK that we can't import the warning classes in xdist.
I believe we need some kind of fix
We seeem to have met the same issue here : https://github.com/smarie/python-pytest-cases/issues/249
The problem has the same cause: the unserialize_warning_message
function of xdist seems to assume that the warning class will be an attribute of the top-level package (not of a sub-package).
INTERNALERROR> File "D:\python_folder\Lib\site-packages\xdist\workermanage.py", line 436, in unserialize_warning_message
INTERNALERROR> cls = getattr(mod, data["message_class_name"])
Of course a workaround is to make our libs expose all warning classes at the top package level. However, there is probably an easier fix to be done in unserialize_warning_message
? Maybe the full qualified name of the warnings class could be serialized so that it can be deserialized ok ?
I found the culprit: https://github.com/smarie/python-pytest-cases/blob/8d11b7de97bd8c18891aa7d5f21cd45539486843/src/pytest_cases/case_parametrizer_new.py#L682-L686
The issue is that I set __module__
myself so that the warning message looks nice... However then the __init__
should contain the class for consistency.
Still, while investigating this issue, I created a few handy tests concerning warning serialization/deserialization. So I'll propose them in a PR
Hello. First of all I would like to thank everyone involved in making and maintaining pytest and xdist, superb job. :) π
Now the situation that is manifesting on my windows7 machine. I'm trying to assemble CI infrastructure using jenkins for running gui tests via pytest and xdist. I decided to use xdist because python process sometimes crashes and I want to continue running the remaining number of tests. I've managed to reproduce situation bellow also in the console (
cmd.exe
) so I don't think this is jenkins related.Bellow we can see one of the commands I'm using to run pytest, I've moved some args onto a new line so it is easier on the eyes.
Above code was executed on jenkins and the one bellow in the console on the same computer.
As far as I can see not all tests are being executed because all nodes crash somewhere along the path and don't restart. Traceback in jenkins and cmd are equal up to the
line 138, in loop_once
where after they start to diverge but end up with the sameKeyError
.I'm also using pytest and xdist for running non gui tests and they work perfectly ok.