Skip to content

Commit 5411b11

Browse files
committed
Merge pull request #53 from pytest-dev/dont-import-version
No longer import pytestqt during setup.py and docs building
2 parents 7dca107 + b240b14 commit 5411b11

File tree

3 files changed

+14
-27
lines changed

3 files changed

+14
-27
lines changed

docs/conf.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@
4747
# |version| and |release|, also used in various other places throughout the
4848
# built documents.
4949
#
50-
import pytestqt
50+
import re
51+
with open('../pytestqt/__init__.py') as f:
52+
m = re.search("version = '(.*)'", f.read())
53+
assert m is not None
54+
version = m.group(1)
5155
# The short X.Y version.
52-
version = pytestqt.version
5356
# The full version, including alpha/beta/rc tags.
54-
release = pytestqt.version
57+
release = version
5558

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

pytestqt/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ def test_hello(qtbot):
2626
2727
'''
2828

29-
version = __version__ = '1.4.0'
29+
version = '1.4.0'
30+
__version__ = version

setup.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,17 @@
1-
import sys
1+
import re
22

33
from setuptools import setup
4-
from setuptools.command.test import test as TestCommand
54

6-
import pytestqt
75

8-
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)
6+
with open('pytestqt/__init__.py') as f:
7+
m = re.search("version = '(.*)'", f.read())
8+
assert m is not None
9+
version = m.group(1)
2610

2711

2812
setup(
2913
name="pytest-qt",
30-
version=pytestqt.version,
14+
version=version,
3115
packages=['pytestqt'],
3216
entry_points={
3317
'pytest11': ['pytest-qt = pytestqt.plugin'],
@@ -56,5 +40,4 @@ def run_tests(self):
5640
'Topic :: Software Development :: User Interfaces',
5741
],
5842
tests_requires=['pytest'],
59-
cmdclass={'test': PyTest},
6043
)

0 commit comments

Comments
 (0)