Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_dunder_main_run_help(capfd):
assert call([sys.executable, '-m', 'covimerage', '--version']) == 0
out, err = capfd.readouterr()
lines = out.splitlines()
assert len(lines) == 1
assert lines[0].startswith('covimerage, version %s' % get_version())
def test_get_version_message_importerror(monkeypatch_importerror):
exc = ImportError('failed')
with monkeypatch_importerror(('coverage',), raise_exc=exc):
assert get_version_message() == (
'covimerage, version %s (using Coverage.py unknown (failed))'
% (get_version(),)
)
exc = ImportError
with monkeypatch_importerror(('coverage',), raise_exc=exc):
assert get_version_message() == (
'covimerage, version %s (using Coverage.py unknown ())'
% (get_version(),)
)
def get_version_message():
from . import get_version
try:
from coverage import __version__ as coverage_version
except ImportError as exc:
coverage_version = 'unknown (%s)' % (exc,)
return 'covimerage, version %s (using Coverage.py %s)' % (
get_version(),
coverage_version,
)