Skip to content

Commit 93041c9

Browse files
committed
Added test command to setup.py that runs pytest
1 parent 4571d90 commit 93041c9

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ before_script:
4141

4242
script:
4343
- python setup.py develop
44-
- py.test --cov pytestqt
44+
- coverage run --source=pytestqt setup.py test
4545

4646
after_success:
4747
- coveralls

pytestqt/_tests/__init__.py

Whitespace-only changes.

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)