Skip to content

Commit 7341315

Browse files
committed
Restore setup.py test command
1 parent 4fc3fb8 commit 7341315

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

setup.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
1+
import sys
12
import re
23

34
from setuptools import setup
5+
from setuptools.command.test import test as TestCommand
6+
7+
8+
class PyTest(TestCommand):
9+
"""
10+
Overrides setup "test" command, taken from here:
11+
http://pytest.org/latest/goodpractises.html
12+
"""
13+
14+
def finalize_options(self):
15+
TestCommand.finalize_options(self)
16+
self.test_args = []
17+
self.test_suite = True
18+
19+
def run_tests(self):
20+
# import here, cause outside the eggs aren't loaded
21+
import pytest
22+
23+
errno = pytest.main([])
24+
sys.exit(errno)
425

526

627
with open('pytestqt/__init__.py') as f:
728
m = re.search("version = '(.*)'", f.read())
829
assert m is not None
930
version = m.group(1)
1031

11-
1232
setup(
1333
name="pytest-qt",
1434
version=version,
@@ -40,4 +60,5 @@
4060
'Topic :: Software Development :: User Interfaces',
4161
],
4262
tests_requires=['pytest'],
63+
cmdclass={'test': PyTest},
4364
)

0 commit comments

Comments
 (0)