Remove pytest-runner

This commit is contained in:
Unrud 2022-07-02 20:37:52 +02:00
parent a2ceaa41a4
commit 413c74c27c
4 changed files with 17 additions and 20 deletions

View File

@ -21,7 +21,7 @@ jobs:
- name: Install from source - name: Install from source
run: python -m pip install --editable .[test,bcrypt] run: python -m pip install --editable .[test,bcrypt]
- name: Run tests - name: Run tests
run: python setup.py test run: python -m pytest
- name: Upload coverage to Coveralls - name: Upload coverage to Coveralls
if: github.event_name == 'push' if: github.event_name == 'push'
env: env:

9
conftest.py Normal file
View File

@ -0,0 +1,9 @@
import sys
from importlib.util import find_spec
def pytest_addoption(parser, pluginmanager):
# Ignore the "--mypy" argument if pytest-mypy is not installed and
# the implementation is not cpython
if sys.implementation.name != 'cpython' and not find_spec("pytest_mypy"):
parser.addoption("--mypy", action="store_true")

View File

@ -1,12 +1,10 @@
[aliases]
test = pytest
[bdist_wheel] [bdist_wheel]
python-tag = py3 python-tag = py3
[tool:pytest] [tool:pytest]
# More options are set in `setup.py` via environment variable `PYTEST_ADDOPTS` # The "--mypy" argument is ignored in conftest.py if pytest-mypy is not
addopts = --flake8 --isort --typeguard-packages=radicale --cov --cov-report=term --cov-report=xml -r s # installed and the implementation is not cpython
addopts = --flake8 --isort --typeguard-packages=radicale --mypy --cov --cov-report=term --cov-report=xml -r s
norecursedirs = dist .cache .git build Radicale.egg-info .eggs venv norecursedirs = dist .cache .git build Radicale.egg-info .eggs venv
[tool:isort] [tool:isort]

View File

@ -36,9 +36,6 @@ For further information, please visit the `Radicale Website
""" """
import os
import sys
from setuptools import find_packages, setup from setuptools import find_packages, setup
# When the version is updated, a new section in the CHANGELOG.md file must be # When the version is updated, a new section in the CHANGELOG.md file must be
@ -52,16 +49,10 @@ WEB_FILES = ["web/internal_data/css/icon.png",
install_requires = ["defusedxml", "passlib", "vobject>=0.9.6", install_requires = ["defusedxml", "passlib", "vobject>=0.9.6",
"python-dateutil>=2.7.3", "python-dateutil>=2.7.3",
"setuptools; python_version<'3.9'"] "setuptools; python_version<'3.9'"]
setup_requires = [] tests_require = ["pytest", "pytest-cov", "pytest-flake8", "pytest-isort",
if {"pytest", "test", "ptr"}.intersection(sys.argv): "typeguard", "waitress",
setup_requires.append("pytest-runner") "pytest-mypy; implementation_name=='cpython'",
tests_require = ["pytest-runner", "pytest<7", "pytest-cov", "pytest-flake8", "types-setuptools; implementation_name=='cpython'"]
"pytest-isort", "typeguard", "waitress"]
os.environ["PYTEST_ADDOPTS"] = os.environ.get("PYTEST_ADDOPTS", "")
# Mypy only supports CPython
if sys.implementation.name == "cpython":
tests_require.extend(["pytest-mypy", "types-setuptools"])
os.environ["PYTEST_ADDOPTS"] += " --mypy"
setup( setup(
name="Radicale", name="Radicale",
@ -80,7 +71,6 @@ setup(
package_data={"radicale": [*WEB_FILES, "py.typed"]}, package_data={"radicale": [*WEB_FILES, "py.typed"]},
entry_points={"console_scripts": ["radicale = radicale.__main__:run"]}, entry_points={"console_scripts": ["radicale = radicale.__main__:run"]},
install_requires=install_requires, install_requires=install_requires,
setup_requires=setup_requires,
tests_require=tests_require, tests_require=tests_require,
extras_require={"test": tests_require, extras_require={"test": tests_require,
"bcrypt": ["passlib[bcrypt]", "bcrypt"]}, "bcrypt": ["passlib[bcrypt]", "bcrypt"]},