diff --git a/.travis.yml b/.travis.yml index 7f3bb013..9b00cc04 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ env: install: - pip install -U setuptools # install_requires - - pip install -U distlib EmPy pytest-rerunfailures pytest pytest-cov pytest-repeat pytest-runner + - pip install -U distlib EmPy pytest-rerunfailures pytest pytest-cov pytest-repeat # additional tests_require - pip install -U flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-deprecated flake8-docstrings flake8-quotes pep8-naming pylint scspell3k # for uploading the coverage information to codecov diff --git a/colcon_core/task/python/test/pytest.py b/colcon_core/task/python/test/pytest.py index 858d25d8..b9cc96cd 100644 --- a/colcon_core/task/python/test/pytest.py +++ b/colcon_core/task/python/test/pytest.py @@ -13,7 +13,6 @@ from colcon_core.task.python.test import has_test_dependency from colcon_core.task.python.test import PythonTestingStepExtensionPoint from colcon_core.verb.test import logger -from pkg_resources import iter_entry_points from pkg_resources import parse_version @@ -29,9 +28,10 @@ def __init__(self): # noqa: D107 satisfies_version( PythonTestingStepExtensionPoint.EXTENSION_POINT_VERSION, '^1.0') - entry_points = iter_entry_points('distutils.commands', name='pytest') - if not list(entry_points): - raise SkipExtensionException("'pytest-runner' not found") + try: + import pytest # noqa: F401 + except ImportError: + raise SkipExtensionException("'pytest' not found") def add_arguments(self, *, parser): # noqa: D102 parser.add_argument( @@ -49,11 +49,7 @@ def match(self, context, env, setup_py_data): # noqa: D102 return has_test_dependency(setup_py_data, 'pytest') async def step(self, context, env, setup_py_data): # noqa: D102 - cmd = [ - sys.executable, - 'setup.py', 'pytest', - 'egg_info', '--egg-base', context.args.build_base, - ] + cmd = [sys.executable, '-m', 'pytest'] junit_xml_path = Path( context.args.test_result_base if context.args.test_result_base diff --git a/debian/patches/setup.cfg.patch b/debian/patches/setup.cfg.patch index 4a696756..51d1ae04 100644 --- a/debian/patches/setup.cfg.patch +++ b/debian/patches/setup.cfg.patch @@ -16,6 +16,6 @@ Author: Dirk Thomas + # would result in a runtime error by pkg_resources + # pytest-repeat + # pytest-rerunfailures - pytest-runner setuptools>=30.3.0 packages = find: + tests_require = diff --git a/setup.cfg b/setup.cfg index 3a01d09c..8b5076fb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,7 +36,6 @@ install_requires = pytest-cov pytest-repeat pytest-rerunfailures - pytest-runner setuptools>=30.3.0 packages = find: tests_require = diff --git a/stdeb.cfg b/stdeb.cfg index 7678095f..4400a288 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,5 +1,5 @@ [colcon-core] No-Python2: -Depends3: python3-distlib, python3-empy, python3-pytest, python3-pytest-cov, python3-pytest-runner, python3-setuptools +Depends3: python3-distlib, python3-empy, python3-pytest, python3-pytest-cov, python3-setuptools Suite: xenial bionic focal stretch buster X-Python3-Version: >= 3.5