Skip to content

Commit 4726dfb

Browse files
committed
Merge remote-tracking branch 'origin/master' into logging
Conflicts: .travis.yml pytestqt/plugin.py
2 parents 9c414d3 + 239cac0 commit 4726dfb

File tree

11 files changed

+418
-116
lines changed

11 files changed

+418
-116
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ __pycache__
66
/pytest_qt.egg-info
77
/build
88
/dist
9+
/.tox
910
.env*
1011
.coverage

.project

Lines changed: 0 additions & 17 deletions
This file was deleted.

.pydevproject

Lines changed: 0 additions & 8 deletions
This file was deleted.

.travis.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ virtualenv:
1010
matrix:
1111
allow_failures:
1212
# unfortunately couldn't find a reliable way to test pyqt5 on travis yet
13-
- env: PYTEST_VERSION=2.7.0 PYTEST_QT_API=pyqt5
13+
- env: PYTEST_VERSION=2.7.1 PYTEST_QT_API=pyqt5
1414

1515
env:
16-
- PYTEST_VERSION=2.7.0 PYTEST_QT_API=pyqt4
17-
- PYTEST_VERSION=2.7.0 PYTEST_QT_API=pyside
18-
- PYTEST_VERSION=2.7.0 PYTEST_QT_API=pyqt5
16+
- PYTEST_VERSION=2.7.1 PYTEST_QT_API=pyqt4
17+
- PYTEST_VERSION=2.7.1 PYTEST_QT_API=pyside
18+
- PYTEST_VERSION=2.7.1 PYTEST_QT_API=pyqt5
1919

2020
install:
2121
- sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
@@ -36,9 +36,10 @@ before_script:
3636
- sh -e /etc/init.d/xvfb start
3737
- sleep 3
3838

39+
3940
script:
4041
- python setup.py develop
41-
- coverage run --source=pytestqt setup.py test
42+
- catchsegv coverage run --source=pytestqt setup.py test
4243

4344
after_success:
4445
- coveralls

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ Many thanks to:
109109
- Benjamin Audren (`@baudren <https://github.com/baudren>`_);
110110
- Fabio Zadrozny (`@fabioz <https://github.com/fabioz>`_);
111111
- Datalyze Solutions (`@datalyze-solutions <https://github.com/datalyze-solutions>`_);
112+
- Florian Bruhin (`@The-Compiler <https://github.com/The-Compiler>`_);
112113

113114
**Powered by**
114115

docs/conf.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,7 @@
9292

9393
# The theme to use for HTML and HTML Help pages. See the documentation for
9494
# a list of builtin themes.
95-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
96-
if on_rtd:
97-
html_theme = 'default'
98-
else:
99-
#html_theme = 'agogo'
100-
html_theme = 'sphinxdoc'
101-
#html_theme = 'scrolls'
102-
#html_theme = 'nature'
103-
#html_theme = 'haiku'
104-
#html_theme = 'pyramid'
95+
html_theme = 'sphinx_rtd_theme'
10596

10697
# Theme options are theme-specific and customize the look and feel of a theme
10798
# further. For a list of options available for each theme, see the

docs/index.rst

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ created earlier::
140140
Waiting for threads, processes, etc.
141141
====================================
142142

143+
.. versionadded:: 1.2
144+
143145
If your program has long running computations running in other threads or
144146
processes, you can use :meth:`qtbot.waitSignal <pytestqt.plugin.QtBot.waitSignal>`
145147
to block a test until a signal is emitted (such as ``QThread.finished``) or a
@@ -161,9 +163,50 @@ ensuring the results are correct::
161163
assert_application_results(app)
162164

163165

166+
167+
raising
168+
-------
169+
170+
.. versionadded:: 1.4
171+
172+
Additionally, you can pass ``raising=True`` to raise a
173+
:class:`qtbot.SignalTimeoutError <SignalTimeoutError>` if the timeout is
174+
reached before the signal is triggered::
175+
176+
def test_long_computation(qtbot):
177+
...
178+
with qtbot.waitSignal(app.worker.finished, raising=True) as blocker:
179+
app.worker.start()
180+
# if timeout is reached, qtbot.SignalTimeoutError will be raised at this point
181+
assert_application_results(app)
182+
183+
184+
waitSignals
185+
-----------
186+
187+
.. versionadded:: 1.4
188+
189+
If you have to wait until **all** signals in a list are triggered, use
190+
:meth:`qtbot.waitSignals <pytestqt.plugin.QtBot.waitSignals>`, which receives
191+
a list of signals instead of a single signal. As with
192+
:meth:`qtbot.waitSignal <pytestqt.plugin.QtBot.waitSignal>`, it also supports
193+
the new ``raising`` parameter::
194+
195+
def test_workers(qtbot):
196+
workers = spawn_workers()
197+
with qtbot.waitSignal([w.finished for w in workers], raising=True):
198+
for w in workers:
199+
w.start()
200+
201+
# this will be reached after all workers emit their "finished"
202+
# signal or a qtbot.SignalTimeoutError will be raised
203+
assert_application_results(app)
204+
164205
Exceptions in virtual methods
165206
=============================
166207

208+
.. versionadded:: 1.1
209+
167210
It is common in Qt programming to override virtual C++ methods to customize
168211
behavior, like listening for mouse events, implement drawing routines, etc.
169212

@@ -229,10 +272,13 @@ QtBot
229272
.. module:: pytestqt.plugin
230273
.. autoclass:: QtBot
231274

232-
SignalBlocker
233-
-------------
275+
Signals
276+
-------
234277

235278
.. autoclass:: SignalBlocker
279+
.. autoclass:: MultiSignalBlocker
280+
281+
.. autoclass:: SignalTimeoutError
236282

237283
Versioning
238284
==========

install-qt.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44
'''
55
import os
66
import sys
7+
import subprocess
78

8-
def run(cmd):
9-
print(cmd)
10-
r = os.system(cmd)
11-
if r != 0:
12-
sys.exit('command %s failed with status %s' % (cmd, r))
9+
10+
def install(packages):
11+
print('Installing %s...' % ', '.join(packages))
12+
subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + packages)
1313

1414
py3k = sys.version_info[0] == 3
1515
if os.environ['PYTEST_QT_API'] in ('pyqt4', 'pyqt5'):
1616
pyqt_ver = os.environ['PYTEST_QT_API'][-1]
1717
if py3k:
18-
run('sudo apt-get install -qq python3-pyqt%s' % pyqt_ver)
18+
pkg = 'python3-pyqt%s' % pyqt_ver
1919
else:
20-
run('sudo apt-get install -qq python-qt%s' % pyqt_ver)
20+
pkg = 'python-qt%s' % pyqt_ver
21+
install([pkg, pkg + '-dbg'])
2122
else:
2223
if py3k:
23-
run('sudo apt-get install -qq python3-pyside')
24+
pkg = 'python3-pyside'
2425
else:
25-
run('sudo apt-get install -qq python-pyside')
26-
26+
pkg = 'python-pyside'
27+
install([pkg])

0 commit comments

Comments
 (0)