Skip to content

Commit 194e7b8

Browse files
committed
Merge branch 'coveralls'
2 parents 7cf755b + d0cf7a2 commit 194e7b8

File tree

9 files changed

+61
-15
lines changed

9 files changed

+61
-15
lines changed

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
*.pyc
2-
__pycache__
3-
*.log
1+
*.pyc
2+
__pycache__
3+
*.log
44
/distribute-0.6.35.tar.gz
55
/distribute-0.6.35-py2.7.egg
66
/pytest_qt.egg-info
77
/build
88
/dist
99
.env*
10+
.coverage

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,17 @@ install:
3131
- pip uninstall -y pytest
3232
- pip install pytest==$PYTEST_VERSION
3333

34+
# others
35+
- pip install pytest-cov coveralls --use-wheel
36+
3437
before_script:
3538
- export DISPLAY=:99.0
3639
- sh -e /etc/init.d/xvfb start
3740
- sleep 3
3841

3942
script:
4043
- python setup.py develop
41-
- py.test
44+
- coverage run --source=pytestqt setup.py test
45+
46+
after_success:
47+
- coveralls

README.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ This allows you to test and make sure your view layer is behaving the way you ex
3030

3131
|version| |downloads| |ci|
3232

33+
.. Using PNG badges because PyPI doesn't support SVG
34+
3335
.. |version| image:: http://img.shields.io/pypi/v/pytest-qt.png
3436
:target: https://crate.io/packages/pytest-qt
3537

@@ -38,7 +40,10 @@ This allows you to test and make sure your view layer is behaving the way you ex
3840

3941
.. |ci| image:: http://img.shields.io/travis/nicoddemus/pytest-qt.png
4042
:target: https://travis-ci.org/nicoddemus/pytest-qt
41-
43+
44+
.. |coverage| image:: http://img.shields.io/coveralls/nicoddemus/pytest-qt.png
45+
:target: https://coveralls.io/r/nicoddemus/pytest-qt
46+
4247

4348
Requirements
4449
============

pytestqt/_tests/__init__.py

Whitespace-only changes.

pytestqt/_tests/test_basics.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pytestqt.qt_compat import QtGui, Qt, QEvent
1+
from pytestqt.qt_compat import QtGui, Qt, QEvent, QtCore
22
import pytest
33

44

@@ -55,7 +55,18 @@ def extract(mouse_event):
5555

5656
qtbot.mousePress(event_recorder, Qt.RightButton, Qt.AltModifier)
5757
assert event_recorder.event_data == (QEvent.MouseButtonPress, Qt.RightButton, Qt.AltModifier)
58-
58+
59+
60+
def test_stop_for_interaction(qtbot):
61+
"""
62+
Test qtbot.stopForInteraction()
63+
"""
64+
widget = QtGui.QWidget()
65+
qtbot.addWidget(widget)
66+
qtbot.waitForWindowShown(widget)
67+
QtCore.QTimer.singleShot(0, widget.close)
68+
qtbot.stopForInteraction()
69+
5970

6071
class EventRecorder(QtGui.QWidget):
6172
"""
@@ -92,5 +103,3 @@ def event_recorder(qtbot):
92103
return widget
93104

94105

95-
if __name__ == '__main__':
96-
pytest.main(args=['-s'])

pytestqt/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def result(*args, **kwargs):
2525
functools.update_wrapper(result, qtest_method)
2626
return staticmethod(result)
2727
else:
28-
return None
28+
return None # pragma: no cover
2929

3030
# inject methods from QTest into QtBot
3131
method_names = [

pytestqt/qt_compat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
1212

13-
if not on_rtd:
13+
if not on_rtd: # pragma: no cover
1414
try:
1515
import PySide.QtCore as _QtCore
1616
QtCore = _QtCore
@@ -54,7 +54,7 @@ def _import_module(moduleName):
5454
Qt = QtCore.Qt
5555
QEvent = QtCore.QEvent
5656

57-
else:
57+
else: # pragma: no cover
5858
USING_PYSIDE = True
5959

6060
# mock Qt when we are generating documentation at readthedocs.org

setup.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
1+
import sys
2+
13
from setuptools import setup
4+
from setuptools.command.test import test as TestCommand
5+
26
import pytestqt
37

48

9+
class PyTest(TestCommand):
10+
"""
11+
Overrides setup "test" command, taken from here:
12+
http://pytest.org/latest/goodpractises.html
13+
"""
14+
15+
def finalize_options(self):
16+
TestCommand.finalize_options(self)
17+
self.test_args = []
18+
self.test_suite = True
19+
20+
def run_tests(self):
21+
# import here, cause outside the eggs aren't loaded
22+
import pytest
23+
24+
errno = pytest.main([])
25+
sys.exit(errno)
26+
27+
528
setup(
629
name="pytest-qt",
730
version=pytestqt.version,
8-
packages=['pytestqt', 'pytestqt._tests'],
31+
packages=['pytestqt'],
932
entry_points={
1033
'pytest11': ['pytest-qt = pytestqt.plugin'],
1134
},
@@ -31,5 +54,7 @@
3154
'Topic :: Software Development :: Quality Assurance',
3255
'Topic :: Software Development :: Testing',
3356
'Topic :: Software Development :: User Interfaces',
34-
]
57+
],
58+
tests_requires=['pytest'],
59+
cmdclass={'test': PyTest},
3560
)

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ envlist = py26, py27, py32, py33, py34, docs
55
[testenv]
66
deps=pytest
77
pyside
8-
commands=py.test {envsitepackagesdir}/pytestqt
8+
commands=py.test
99

1010
[testenv:docs]
1111
deps=pytest

0 commit comments

Comments
 (0)