Skip to content

Commit a43bc63

Browse files
committed
Use distutils-pytest to run the test suite
1 parent 8cc61f7 commit a43bc63

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

.github/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
distutils-pytest
12
pathlib ; python_version == '2.7'
23
pytest >=3.7.0
34
setuptools_scm

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ BUILDLIB = $(CURDIR)/build/lib
55
build:
66
$(PYTHON) setup.py build
77

8-
test: build
9-
PYTHONPATH=$(BUILDLIB) $(PYTHON) -m pytest tests
8+
test:
9+
$(PYTHON) setup.py test
1010

1111
sdist:
1212
$(PYTHON) setup.py sdist

README.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Optional library packages:
4545
package is only needed to build out of the plain development source
4646
tree as cloned from GitHub.
4747

48+
+ `distutils-pytest`_ >= 0.2
49+
50+
Only needed to run the test suite.
51+
4852

4953
Installation
5054
------------
@@ -57,7 +61,7 @@ Installation
5761

5862
3. Test (optional)::
5963

60-
$ PYTHONPATH=build/lib python -m pytest tests
64+
$ python setup.py test
6165

6266
4. Install::
6367

@@ -102,4 +106,5 @@ permissions and limitations under the License.
102106
.. _setuptools: http://pypi.python.org/pypi/setuptools/
103107
.. _pytest: http://pytest.org/
104108
.. _setuptools_scm: https://github.com/pypa/setuptools_scm/
109+
.. _distutils-pytest: https://github.com/RKrahl/distutils-pytest
105110
.. _Read the Docs site: https://pytest-dependency.readthedocs.io/

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
from pathlib import Path
1616
from stat import ST_ATIME, ST_MTIME, ST_MODE, S_IMODE
1717
import string
18+
try:
19+
import distutils_pytest
20+
cmdclass = distutils_pytest.cmdclass
21+
except (ImportError, AttributeError):
22+
cmdclass = dict()
1823
try:
1924
import setuptools_scm
2025
version = setuptools_scm.get_version()
@@ -142,5 +147,5 @@ def run(self):
142147
"dependency = pytest_dependency",
143148
],
144149
},
145-
cmdclass = dict(build_py=build_py, sdist=sdist, meta=meta),
150+
cmdclass = dict(cmdclass, build_py=build_py, sdist=sdist, meta=meta),
146151
)

0 commit comments

Comments
 (0)