Skip to content

API break suggestions for 4.0 #306

@The-Compiler

Description

@The-Compiler

As mentioned in #302 (comment) 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 in pytest.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 and waitForWindowShown (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 a timeout as well? (can be done after 4.0)
  • 4. Does anyone really use qtbot.stopForInteraction() instead of qtbot.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 and waitSignals can take None instead of a signal, in which case they just wait until the timeout occurred. But we already have qtbot.wait() for that, so is there a reason to support it?
  • 7. Can we get rid of the SignalTimeoutError compatibility alias for TimeoutError?
  • 8. The docs for pytestqt.logging.Record says that context 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions