File tree Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Original file line number Diff line number Diff line change 1
- # pytest-qt #
1
+ =========
2
+ pytest-qt
3
+ =========
2
4
3
- pytest-qt is a [ pytest]( http://pytest.org) plugin that provides fixtures to help
4
- programmers write tests for [ PySide]( https://pypi.python.org/pypi/PySide) and [PyQt](http://www.riverbankcomputing.com/software/pyqt)
5
- applications.
5
+ pytest-qt is a ` pytest < http://pytest.org >`_ plugin to allow
6
+ programmers write tests for ` PySide < https://pypi.python.org/pypi/PySide >`_ and
7
+ ` PyQt < http://www.riverbankcomputing.com/software/pyqt >`_ applications.
6
8
7
- The main usage is to use the `qtbot ` fixture, responsible for handling `qApp ` creation as needed and provides methods to
8
- simulate user interaction, like key presses and mouse clicks:
9
+ The main usage is to use the `qtbot ` fixture, responsible for handling `qApp `
10
+ creation as needed and provides methods to simulate user interaction,
11
+ like key presses and mouse clicks::
9
12
10
- `` `python
11
- def test_hello(qtbot):
12
- widget = HelloWidget()
13
- qtbot.addWidget(widget)
13
+
14
+ def test_hello(qtbot):
15
+ widget = HelloWidget()
16
+ qtbot.addWidget(widget)
14
17
15
- # click in the Greet button and make sure it updates the appropriate label
16
- qtbot.mouseClick(window.button_greet, QtCore.Qt.LeftButton)
18
+ # click in the Greet button and make sure it updates the appropriate label
19
+ qtbot.mouseClick(window.button_greet, QtCore.Qt.LeftButton)
17
20
18
- assert window.greet_label.text() == 'Hello!'
19
- ` ``
21
+ assert window.greet_label.text() == 'Hello!'
22
+
20
23
21
24
This allows you to test and make sure your view layer is behaving the way you expect after each code change.
22
25
You can’t perform that action at this time.
0 commit comments