From 3446e77c43b7c88c72c8285bf771d557a3a09a75 Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Mon, 31 May 2021 21:58:27 +0200 Subject: [PATCH] Skip some tests on certbot-apache on Windows to avoid pytest to fail --- certbot-apache/tests/conftest.py | 6 ++++-- tox.cover.py | 8 -------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/certbot-apache/tests/conftest.py b/certbot-apache/tests/conftest.py index 0c84927cf..e9b8ca563 100644 --- a/certbot-apache/tests/conftest.py +++ b/certbot-apache/tests/conftest.py @@ -1,6 +1,8 @@ import sys + def pytest_ignore_collect(path, config): # pragma: no cover - # Do not run any test for certbot-apache on Windows. + # Do not run any test for certbot-apache on Windows, except obj_test which is safe + # (to avoid pytest to fail because no test was found). if sys.platform == 'win32': - return True + return path.basename != 'obj_test.py' diff --git a/tox.cover.py b/tox.cover.py index dc2ce5226..d433a54ff 100755 --- a/tox.cover.py +++ b/tox.cover.py @@ -34,20 +34,12 @@ COVER_THRESHOLDS = { 'certbot_nginx': {'linux': 97, 'windows': 97}, } -SKIP_PROJECTS_ON_WINDOWS = ['certbot-apache'] - def cover(package): threshold = COVER_THRESHOLDS.get(package)['windows' if os.name == 'nt' else 'linux'] pkg_dir = package.replace('_', '-') - if os.name == 'nt' and pkg_dir in SKIP_PROJECTS_ON_WINDOWS: - print(( - 'Info: currently {0} is not supported on Windows and will not be tested/covered.' - .format(pkg_dir))) - return - subprocess.check_call([sys.executable, '-m', 'pytest', '--cov', pkg_dir, '--cov-append', '--cov-report=', pkg_dir]) try: