Skip some tests on certbot-apache on Windows to avoid pytest to fail

This commit is contained in:
Adrien Ferrand 2021-05-31 21:58:27 +02:00
parent b9efadce45
commit 3446e77c43
2 changed files with 4 additions and 10 deletions

View file

@ -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'

View file

@ -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: