Fetch signal names from PySide6 signal instances#648
Fetch signal names from PySide6 signal instances#648flowln wants to merge 1 commit intopytest-dev:masterfrom
Conversation
This allows PySide6 tests to populate signals_and_args in waitSignals, which makes it compatible with PyQt. Signed-off-by: Sofia Donato Ferreira <sofia.ferreira@lnls.br>
The-Compiler
left a comment
There was a problem hiding this comment.
Oh, that's really nice! I think the tests will need some clean up, but really glad to hear that this actually works, I had no idea!
| assert blocker.all_signals_and_args == [] | ||
|
|
||
| def test_empty_when_no_signal_name_available(self, qtbot, signaller): | ||
| def test_non_empty_on_pyside(self, qtbot, signaller): |
There was a problem hiding this comment.
The docstring and the pytest.skip call below don't make sense anymore with this change.
However, if we can adjust get_mixed_signals_with_guaranteed_name() to not require special handling of PySide anymore, I think the tests could be simplified a lot (no need for that helper function anymore), and then e.g. this test is probably completely superfluous anyways?
| ).format(signal_args, signal_args) | ||
|
|
||
| def test_degenerate_error_msg(self, qtbot, signaller): | ||
| def test_error_msg_on_pyside(self, qtbot, signaller): |
There was a problem hiding this comment.
As above, when adjusting (or removing) get_mixed_signals_with_guaranteed_name, I think this won't be needed as a separate test anymore.
| return signal_name | ||
|
|
||
| def _extract_pyside_signal_name(self, potential_pyside_signal): | ||
| meta_method = qt_api.QtCore.QMetaMethod.fromSignal(potential_pyside_signal) |
There was a problem hiding this comment.
FWIW, on PyQt (both 5 and 6), I get AttributeError: type object 'QMetaMethod' has no attribute 'fromSignal', so it looks like the split between PyQt/PySide is still needed.
|
Oh, looking at the CI results, PySide 6.0 also lacks @nicoddemus what do you think? |

The signal names can be fetched by looking at the
QMetaMethodassociated with the signals. I'm not sure if PyQt also allows for that, in which case it would make sense to handle both in the same way, but at least for now this can provide some improvement.This allows PySide6 tests to populate
signals_and_argsinwaitSignals, which makes it compatible with PyQt. This improves the test development process by unifying handling of both versions.