Skip to content

Commit

Permalink
Improve add_widget error message by including the widget
Browse files Browse the repository at this point in the history
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
  • Loading branch information
larsoner and nicoddemus committed Apr 10, 2024
1 parent 3b540b8 commit 7d84cc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pytestqt/qtbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def addWidget(self, widget, *, before_close_func=None):
.. note:: This method is also available as ``add_widget`` (pep-8 alias)
"""
if not isinstance(widget, qt_api.QtWidgets.QWidget):
raise TypeError("Need to pass a QWidget to addWidget!")
raise TypeError(f"Need to pass a QWidget to addWidget: {widget!r}")
_add_widget(self._request.node, widget, before_close_func=before_close_func)

def waitActive(self, widget, *, timeout=5000):
Expand Down

0 comments on commit 7d84cc7

Please sign in to comment.