API break suggestions for 4.0
See original GitHub issueAs mentioned in https://github.com/pytest-dev/pytest-qt/pull/302#issuecomment-629513007 I went through the docs/code and thought about possible API breaks which would make sense for 4.0. Here are a couple of ideas:
- 1. One thing that always irked me a bit is that we have two naming conventions (
add_widget
vs.addWidget
). Is it really a good idea to support both? At least in my project, it only lead to using both inconsistently over the years without noticing. Should we get rid of one of those? On the other hand, that’s probably a lot of churn for projects using pytest-qt, so I’m not sure if it’s worth it. Maybe as an alternative, we could make it possible to configure the desired API style inpytest.ini
so that the other style would raise an exception (that could be done after 4.0)? - 2. Right now the user needs to decide between
waitActive
,waitExposed
andwaitForWindowShown
(which might be a hurdle if using the same tests for two different backends). Should we have a wrapper which decides what to use instead? - 3. Shouldn’t
waitForWindowShown
have atimeout
as well? (can be done after 4.0) - 4. Does anyone really use
qtbot.stopForInteraction()
instead ofqtbot.stop()
? A GitHub search reveals 60 results, vs. 122 results for.stop()
, though I guess it’s mostly used interactively for debugging without being added to the code. Should we remove the long name? - 5. Should we raise the default timeout for
waitSignal()
to 5000, similar to QSignalSpy.wait() in Qt and the other default timeouts in pytest-qt? - 6.
waitSignal
andwaitSignals
can takeNone
instead of a signal, in which case they just wait until the timeout occurred. But we already haveqtbot.wait()
for that, so is there a reason to support it? - 7. Can we get rid of the
SignalTimeoutError
compatibility alias forTimeoutError
? - 8. The docs for
pytestqt.logging.Record
says thatcontext
is only available for Qt 5, that can probably be removed now (can be done after 4.0) - 9. (new, see below) Get rid of
qt_wait_signal_raising
- 10. (new, see below) Get rid of aliases in
plugin.py
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
API break suggestions for 4.0 · Issue #306 · pytest-dev ...
1. One thing that always irked me a bit is that we have two naming conventions ( add_widget vs. · 2. Right now...
Read more >c# - Breaking changes in .NET 4.0
So I wonder what are other changes and is it possible to find at least preliminary list of changes that will or may...
Read more >Looker API 4.0 Generally Available
The generally available API 4.0 will have multiple breaking and additive changes and will promote multiple endpoints from Beta to Stable.
Read more >API upgrades | Stripe Documentation
To safely upgrade your webhooks, Stripe recommends that you: Check for breaking changes to see which objects will be structured differently.
Read more >Runtime Changes for Migration from .NET Framework 4.0 ...
These same APIs break some ApiVerifier scenarios when HighVersionLie is enabled. Suggestion. This bug can be avoided by upgrading to .NET ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
All done! 🎉
So I had a
quicklook at thewaitActive
,waitExposed
andwaitForWindowShown
situation, and here’s what I gathered:waitActive
andwaitExposed
) were added in Qt 5.0 and still exist in Qt 6. Those we should probably keep as-is.qWaitForWindowShown
is indeed that the name is confusing, and it’s indeed just an alias toqWaitForWindowExposed
qWaitForWindowShown
if available (falling back toqWaitForWindowExposed
otherwise), but this was changed later as part of #159.QtTest.QTest.qWaitForWindowShown
at all, probably because it was obsolete with Qt 5.0 already.Now with Qt 4 support dropped, in theory we could also drop
waitForWindowShown
entirely. However, it seems quite widely used:So it seems to me like we accidentally kept something alive which was long obsoleted/deprecated, and due to the pytest-qt layer, users wouldn’t notice any deprecation warnings (or the removals in the Qt 5 wrappers) at all…
Another problem is that we document both
waitActive
andwaitExposed
as:and indeed do so:
https://github.com/pytest-dev/pytest-qt/blob/5ea3a3d292dd30b721ef333d9372a221abbbd5a9/src/pytestqt/qtbot.py#L732-L733
but in fact at least the underlying Qt functions are available with both PySide2 and PySide6. Looking at #159, I think what we actually wanted to say there is that it’s not available with PyQt4 and PySide (i.e. on Qt 4), but at that time PyQt5 was the only supported Qt 5 wrapper. Somehow this stayed around until today, despite PySide2 and then later PyQt6 and PySide6 being added…
So I’m not sure how to proceed here. We definitely should support all wrappers with
waitActive
andwaitExposed
, but what do we do withwaitForWindowShown
given the widespread usage (and only option so far if using PySide2 or Qt 6)? Options I can think of:PYTEST_QT_API
is set to PySide6/PyQt6 (because the upstream method is fully gone there)What do you think @nicoddemus?