mirror of
https://github.com/certbot/certbot.git
synced 2025-08-09 15:02:48 +03:00
Certbot relies heavily on bash scripts to deploy a development environment and to execute tests. This is fine for Linux systems, including Travis, but problematic for Windows machines. This PR converts all theses scripts into Python, to make them platform independant. As a consequence, tox-win.ini is not needed anymore, and tox can be run indifferently on Windows or on Linux using a common tox.ini. AppVeyor is updated accordingly to execute tests for acme, certbot and all dns plugins. Other tests are not executed as they are for Docker, unsupported Apache/Nginx/Postfix plugins (for now) or not relevant for Windows (explicit Linux distribution tests or pylint). Another PR will be done on certbot website to update how a dev environment can be set up. * Replace several shell scripts by python equivalent. * Correction on tox coverage * Extend usage of new python scripts * Various corrections * Replace venv construction bash scripts by python equivalents * Update tox.ini * Unicode lines to compare files * Put modifications on letsencrypt-auto-source instead of generated scripts * Add executable permissions for Linux. * Merge tox win tests into main tox * Skip lock_test on Windows * Correct appveyor config * Update appveyor.yml * Explicit coverage py27 or py37 * Avoid to cover non supported certbot plugins on Windows * Update tox.ini * Remove specific warnings during CI * No cover on a debug code for tests only. * Update documentation and help script on venv/venv3.py * Customize help message for Windows * Quote correctly executable path with potential spaces in it. * Copy pipstrap from upstream
86 lines
2.7 KiB
Python
Executable File
86 lines
2.7 KiB
Python
Executable File
#!/usr/bin/env python
|
|
import argparse
|
|
import subprocess
|
|
import os
|
|
import sys
|
|
|
|
DEFAULT_PACKAGES = [
|
|
'certbot', 'acme', 'certbot_apache', 'certbot_dns_cloudflare', 'certbot_dns_cloudxns',
|
|
'certbot_dns_digitalocean', 'certbot_dns_dnsimple', 'certbot_dns_dnsmadeeasy',
|
|
'certbot_dns_gehirn', 'certbot_dns_google', 'certbot_dns_linode', 'certbot_dns_luadns',
|
|
'certbot_dns_nsone', 'certbot_dns_ovh', 'certbot_dns_rfc2136', 'certbot_dns_route53',
|
|
'certbot_dns_sakuracloud', 'certbot_nginx', 'certbot_postfix', 'letshelp_certbot']
|
|
|
|
COVER_THRESHOLDS = {
|
|
'certbot': 98,
|
|
'acme': 100,
|
|
'certbot_apache': 100,
|
|
'certbot_dns_cloudflare': 98,
|
|
'certbot_dns_cloudxns': 99,
|
|
'certbot_dns_digitalocean': 98,
|
|
'certbot_dns_dnsimple': 98,
|
|
'certbot_dns_dnsmadeeasy': 99,
|
|
'certbot_dns_gehirn': 97,
|
|
'certbot_dns_google': 99,
|
|
'certbot_dns_linode': 98,
|
|
'certbot_dns_luadns': 98,
|
|
'certbot_dns_nsone': 99,
|
|
'certbot_dns_ovh': 97,
|
|
'certbot_dns_rfc2136': 99,
|
|
'certbot_dns_route53': 92,
|
|
'certbot_dns_sakuracloud': 97,
|
|
'certbot_nginx': 97,
|
|
'certbot_postfix': 100,
|
|
'letshelp_certbot': 100
|
|
}
|
|
|
|
SKIP_PROJECTS_ON_WINDOWS = [
|
|
'certbot-apache', 'certbot-nginx', 'certbot-postfix', 'letshelp-certbot']
|
|
|
|
def cover(package):
|
|
threshold = COVER_THRESHOLDS.get(package)
|
|
|
|
if not threshold:
|
|
raise ValueError('Unrecognized package: {0}'.format(package))
|
|
|
|
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.call([
|
|
sys.executable, '-m', 'pytest', '--cov', pkg_dir, '--cov-append', '--cov-report=',
|
|
'--numprocesses', 'auto', '--pyargs', package])
|
|
subprocess.call([
|
|
sys.executable, '-m', 'coverage', 'report', '--fail-under', str(threshold), '--include',
|
|
'{0}/*'.format(pkg_dir), '--show-missing'])
|
|
|
|
def main():
|
|
description = """
|
|
This script is used by tox.ini (and thus by Travis CI and AppVeyor) in order
|
|
to generate separate stats for each package. It should be removed once those
|
|
packages are moved to a separate repo.
|
|
|
|
Option -e makes sure we fail fast and don't submit to codecov."""
|
|
parser = argparse.ArgumentParser(description=description)
|
|
parser.add_argument('--packages', nargs='+')
|
|
|
|
args = parser.parse_args()
|
|
|
|
packages = args.packages or DEFAULT_PACKAGES
|
|
|
|
# --cov-append is on, make sure stats are correct
|
|
try:
|
|
os.remove('.coverage')
|
|
except OSError:
|
|
pass
|
|
|
|
for package in packages:
|
|
cover(package)
|
|
|
|
if __name__ == '__main__':
|
|
main()
|