Skip to content

Conversation

@rrzaripov
Copy link
Contributor

Just fix variable name to widget. Tested using this HelloWidget class:

from PyQt4 import QtCore, QtGui


class HelloWidget(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.button_greet = QtGui.QPushButton()
        self.greet_label = QtGui.QLabel()
        self.connect(self.button_greet, QtCore.SIGNAL('clicked()'),
                     self, QtCore.SLOT('set_text()'))

    @QtCore.pyqtSlot()
    def set_text(self):
        self.greet_label.setText('Hello!')


def test_hello(qtbot):
    widget = HelloWidget()
    qtbot.addWidget(widget)

    # click in the Greet button and make sure it updates the appropriate label
    qtbot.mouseClick(widget.button_greet, QtCore.Qt.LeftButton)

    assert widget.greet_label.text() == 'Hello!'

@coveralls
Copy link

coveralls commented Jul 9, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling 759b30d on rrzaripov:clarify-example-in-readme into 6996b75 on pytest-dev:master.

@nicoddemus
Copy link
Member

Thanks a lot!

@nicoddemus nicoddemus merged commit f4a6bbb into pytest-dev:master Jul 9, 2016
@rrzaripov rrzaripov deleted the clarify-example-in-readme branch July 9, 2016 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants