Skip to content

Commit 16f0fb8

Browse files
committed
moved package to the root of the repository for easier setup
Also included a new QtBot method, stopForInteraction
1 parent c641ff3 commit 16f0fb8

File tree

8 files changed

+41
-9
lines changed

8 files changed

+41
-9
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
*.pyc
22
__pycache__
33
*.log
4+
/distribute-0.6.35.tar.gz
5+
/distribute-0.6.35-py2.7.egg
6+
/pytest_qt.egg-info
7+
/build
8+
/dist

.pydevproject

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
44
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
55
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
6-
<path>/pytest-qt/src</path>
6+
<path>/pytest-qt</path>
77
</pydev_pathproperty>
88
</pydev_project>

docs/conf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# If extensions (or modules to document with autodoc) are in another directory,
1717
# add these directories to sys.path here. If the directory is relative to the
1818
# documentation root, use os.path.abspath to make it absolute, like shown here.
19-
sys.path.insert(0, os.path.abspath('../src'))
19+
sys.path.insert(0, os.path.abspath('..'))
2020

2121
# -- General configuration -----------------------------------------------------
2222

@@ -47,10 +47,11 @@
4747
# |version| and |release|, also used in various other places throughout the
4848
# built documents.
4949
#
50+
import pytestqt
5051
# The short X.Y version.
51-
version = '0.2.0'
52+
version = pytestqt.version
5253
# The full version, including alpha/beta/rc tags.
53-
release = '0.2.0'
54+
release = pytestqt.release
5455

5556
# The language for content autogenerated by Sphinx. Refer to documentation
5657
# for a list of supported languages.

src/pytestqt/__init__.py renamed to pytestqt/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@ def test_hello(qtbot):
2020
.. _PySide: https://pypi.python.org/pypi/PySide
2121
.. _PyQt: http://www.riverbankcomputing.com/software/pyqt
2222
23-
'''
23+
'''
24+
25+
# The short X.Y version.
26+
version = '0.3'
27+
# The full version, including alpha/beta/rc tags.
28+
release = '0.3'
File renamed without changes.
File renamed without changes.

src/pytestqt/conftest.py renamed to pytestqt/conftest.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ class QtBot(object):
1717
1818
.. automethod:: addWidget
1919
.. automethod:: waitForWindowShown
20+
.. automethod:: stopForInteraction
2021
21-
**QTest API**
22+
**Raw QTest API**
2223
23-
Methods below are forwarded directly to the `QTest API`_. Consult documentation for more
24+
Methods below provide very low level functions, as sending a single mouse click or a key event.
25+
Thos methods are just forwarded directly to the `QTest API`_. Consult the documentation for more
2426
information.
2527
2628
---
@@ -87,7 +89,7 @@ class QtBot(object):
8789
* ``Qt.LeftButton``: The left button is pressed, or an event refers to the left button. (The left button may be the right button on left-handed mice.)
8890
* ``Qt.RightButton``: The right button.
8991
* ``Qt.MidButton``: The middle button.
90-
* ``Qt.MiddleButton``: he middle button.
92+
* ``Qt.MiddleButton``: The middle button.
9193
* ``Qt.XButton1``: The first X button.
9294
* ``Qt.XButton2``: The second X button.
9395
@@ -114,7 +116,7 @@ def __init__(self, app):
114116

115117
def _close(self):
116118
'''
117-
Clear up method. Called at the end of each test that uses a qtbot fixture.
119+
Clear up method. Called at the end of each test that uses a ``qtbot`` fixture.
118120
'''
119121
for w in self._widgets:
120122
w.close()
@@ -142,6 +144,25 @@ def waitForWindowShown(self, widget):
142144
Widget to wait on.
143145
'''
144146
QtTest.QTest.qWaitForWindowShown(widget)
147+
148+
149+
def stopForInteraction(self):
150+
'''
151+
Stops the current test flow, letting the user interact with any visible widget.
152+
153+
This is mainly useful so that you can verify the current state of the program while writing
154+
tests.
155+
156+
Closing the windows should resume the test run, with ``qtbot`` attempting to restore visibility
157+
of the widgets as they were before this call.
158+
'''
159+
widget_visibility = [widget.isVisible() for widget in self._widgets]
160+
161+
self._app.exec_()
162+
163+
for index, visible in enumerate(widget_visibility):
164+
widget = self._widgets[index]
165+
widget.setVisible(visible)
145166

146167

147168
#===================================================================================================
File renamed without changes.

0 commit comments

Comments
 (0)