certbot/tools/venv.py
Adrien Ferrand b3d2ac5161 Fail-fast in test/cover/lint scripts (#6487)
After #6485 and #6435, it appears that there is no good reason to not fail fast when test, cover or linting scripts are executed.

This PR ensures to fail fast by invoking commands throught subprocess.check_call instead of subprocess.call, and by removing the handling of non-zero exit code at the end of theses scripts.

As now coverage on Windows is executed with thresholds, I added specific thresholds for this platform. Because some portions of code that are done for Unix platform will not be executed on Windows.

Note that coverage reports from Travis and AppVeyor are accumulated on Codecov. So if a file is covered up to 50 % on Linux, and all other parts are covered on Windows, then coverage is 100 % for Codecov.

Note: that PR also fixes the ability of coverage tests to fail if thresholds are exceeded.

* Use check_call to fail fast in all scripts related to tests/lint/coverage/deploy

* Make specific coverage threshold for windows
2018-11-14 13:57:40 -08:00

59 lines
1.6 KiB
Python
Executable file

#!/usr/bin/env python
# Developer virtualenv setup for Certbot client
from __future__ import absolute_import
import os
import subprocess
import sys
import _venv_common
REQUIREMENTS = [
'-e acme[dev]',
'-e .[dev,docs]',
'-e certbot-apache',
'-e certbot-dns-cloudflare',
'-e certbot-dns-cloudxns',
'-e certbot-dns-digitalocean',
'-e certbot-dns-dnsimple',
'-e certbot-dns-dnsmadeeasy',
'-e certbot-dns-gehirn',
'-e certbot-dns-google',
'-e certbot-dns-linode',
'-e certbot-dns-luadns',
'-e certbot-dns-nsone',
'-e certbot-dns-ovh',
'-e certbot-dns-rfc2136',
'-e certbot-dns-route53',
'-e certbot-dns-sakuracloud',
'-e certbot-nginx',
'-e certbot-postfix',
'-e letshelp-certbot',
'-e certbot-compatibility-test',
]
def get_venv_args():
with open(os.devnull, 'w') as fnull:
command_python2_st_code = subprocess.call(
'command -v python2', shell=True, stdout=fnull, stderr=fnull)
if not command_python2_st_code:
return '--python python2'
command_python27_st_code = subprocess.call(
'command -v python2.7', shell=True, stdout=fnull, stderr=fnull)
if not command_python27_st_code:
return '--python python2.7'
raise ValueError('Couldn\'t find python2 or python2.7 in {0}'.format(os.environ.get('PATH')))
def main():
if os.name == 'nt':
raise ValueError('Certbot for Windows is not supported on Python 2.x.')
venv_args = get_venv_args()
_venv_common.main('venv', venv_args, REQUIREMENTS)
if __name__ == '__main__':
main()