Closed KennethNielsen closed 9 months ago
Hi @KennethNielsen,
I have never seen that exception before.
whether qtbot does something asynchronously to the inheritance tree of the objects under test, possibly to inject behavior.
Nothing of the sort, QtBot
is just a class like any other, providing methods to interact with widgets, you can see the code here:
https://github.com/pytest-dev/pytest-qt/blob/master/src/pytestqt/qtbot.py
I'm would be greatly thankful for any sort of insight or idea of where I might start to look.
I did know about PySide6.QtWidgets.QWidgetItem
before, but from a glancing look at the docs, I think it might be an internal class that is used as a "placeholder" for an actual widget inside a layout, perhaps momentarily, being replaced by the actual widget later at some point?. But this is just a guess, and not sure how related to your problem is.
Can you change FloatInput
to use super()
?
@nicoddemus thanks for your reply.
Can you change FloatInput to use super()?
I can, and I did, unfortunately it didn't fix the problem.
I did know about PySide6.QtWidgets.QWidgetItem before, but from a glancing look at the docs, I think it might be an internal class that is used as a "placeholder" for an actual widget inside a layout, perhaps momentarily, being replaced by the actual widget later at some point?. But this is just a guess, and not sure how related to your problem is.
Yeah, that was what I got as well, the feeling that it is a placeholder. I think that may point in the direction of this being related to PySide somehow. Maybe those placeholders are being replaced by real widgets asynchronously (for fast loading possibly) or something. I think it will try the PySide community for some input on this.
In any case. From you answers I don't see any reason to suspect that pytest-qt is involved, so I will thank you for your answer and close the issue.
Good luck.
If you find the source of the issue, please come back and share. 👍
Dear pytest-qt devs
First and foremost, thank you for an awesome tool!
I have run into an issue that I don't really know what to make of. I also do not know at all if this is even a pytest-qt issues, I'm mostly just looking for information.
I have the problem that occasionally one of my tests will fail. It happen intermittently and I have been unable so far to force the re-production of the issue. But I do know that it is more frequent in CI on GitHub Actions, than it is on local machines (Assuming that average CPU load is higher on GH Actions, I even tried stressing the CPU to see whether that would increase the failure rate locally, but without success). The failure I get is this:
and a (shortened) representation of the offending code is something like this:
The
lineEdit
of theQDoubleSpinBox
that we inherit from, definitely is supposed to have areturnPressed
property (signal really). One thing that I noticed, is that the author of the code opted for the old-style way of calling__init__
on the parent. Since it is single inheritance, the two should be the same, but it lead me down the route of thinking about whether qtbot does something asynchronously to the inheritance tree of the objects under test, possibly to inject behavior. If it did, that might explain whyQDoubleSpinBox.__init__(self)
might not be the same assuper().__init__()
. An additional interesting tidbit is that the error identifies the object as aQWidgetItem
, which isn't even in the inheritance tree under normal operation. The__mro__
looks like this:Besides from the speculation above, I'm would be greatly thankful for any sort of insight or idea of where I might start to look.
I should mention, that I am not sure that pytest-qt is even involved in the problem. I have never seen it when running normally, but these objects are also initialized a lot more under test than under normal run, so it can also be that this is problem with my use of PySide, that I'm just only seeing under test.
Software versions: