Skip to content

Commit 01d3eb0

Browse files
authored
invoke pytest directly instead of through the setup.py file (#296)
1 parent d4c0d27 commit 01d3eb0

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env:
88
install:
99
- pip install -U setuptools
1010
# install_requires
11-
- pip install -U distlib EmPy pytest-rerunfailures pytest pytest-cov pytest-repeat pytest-runner
11+
- pip install -U distlib EmPy pytest-rerunfailures pytest pytest-cov pytest-repeat
1212
# additional tests_require
1313
- pip install -U flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-deprecated flake8-docstrings flake8-quotes pep8-naming pylint scspell3k
1414
# for uploading the coverage information to codecov

colcon_core/task/python/test/pytest.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from colcon_core.task.python.test import has_test_dependency
1414
from colcon_core.task.python.test import PythonTestingStepExtensionPoint
1515
from colcon_core.verb.test import logger
16-
from pkg_resources import iter_entry_points
1716
from pkg_resources import parse_version
1817

1918

@@ -29,9 +28,10 @@ def __init__(self): # noqa: D107
2928
satisfies_version(
3029
PythonTestingStepExtensionPoint.EXTENSION_POINT_VERSION, '^1.0')
3130

32-
entry_points = iter_entry_points('distutils.commands', name='pytest')
33-
if not list(entry_points):
34-
raise SkipExtensionException("'pytest-runner' not found")
31+
try:
32+
import pytest # noqa: F401
33+
except ImportError:
34+
raise SkipExtensionException("'pytest' not found")
3535

3636
def add_arguments(self, *, parser): # noqa: D102
3737
parser.add_argument(
@@ -49,11 +49,7 @@ def match(self, context, env, setup_py_data): # noqa: D102
4949
return has_test_dependency(setup_py_data, 'pytest')
5050

5151
async def step(self, context, env, setup_py_data): # noqa: D102
52-
cmd = [
53-
sys.executable,
54-
'setup.py', 'pytest',
55-
'egg_info', '--egg-base', context.args.build_base,
56-
]
52+
cmd = [sys.executable, '-m', 'pytest']
5753
junit_xml_path = Path(
5854
context.args.test_result_base
5955
if context.args.test_result_base

debian/patches/setup.cfg.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ Author: Dirk Thomas <[email protected]>
1616
+ # would result in a runtime error by pkg_resources
1717
+ # pytest-repeat
1818
+ # pytest-rerunfailures
19-
pytest-runner
2019
setuptools>=30.3.0
2120
packages = find:
21+
tests_require =

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ install_requires =
3636
pytest-cov
3737
pytest-repeat
3838
pytest-rerunfailures
39-
pytest-runner
4039
setuptools>=30.3.0
4140
packages = find:
4241
tests_require =

stdeb.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[colcon-core]
22
No-Python2:
3-
Depends3: python3-distlib, python3-empy, python3-pytest, python3-pytest-cov, python3-pytest-runner, python3-setuptools
3+
Depends3: python3-distlib, python3-empy, python3-pytest, python3-pytest-cov, python3-setuptools
44
Suite: xenial bionic focal stretch buster
55
X-Python3-Version: >= 3.5

0 commit comments

Comments
 (0)