Skip to content

Commit 7d84cc7

Browse files
larsonernicoddemus
andauthored
Improve add_widget error message by including the widget
Co-authored-by: Bruno Oliveira <[email protected]>
1 parent 3b540b8 commit 7d84cc7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/pytestqt/qtbot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def addWidget(self, widget, *, before_close_func=None):
185185
.. note:: This method is also available as ``add_widget`` (pep-8 alias)
186186
"""
187187
if not isinstance(widget, qt_api.QtWidgets.QWidget):
188-
raise TypeError("Need to pass a QWidget to addWidget!")
188+
raise TypeError(f"Need to pass a QWidget to addWidget: {widget!r}")
189189
_add_widget(self._request.node, widget, before_close_func=before_close_func)
190190

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

0 commit comments

Comments
 (0)