Make sure that bzr is available when running under Travis.

This commit is contained in:
Jelmer Vernooij 2019-01-21 22:42:41 +00:00
parent eb7d4b2178
commit bb385e2dbb
No known key found for this signature in database
GPG Key ID: 579C160D4C9E23E8
2 changed files with 21 additions and 1 deletions

View File

@ -4,8 +4,20 @@ Contains functional tests of the Bazaar class.
import os
import pytest
from pip._internal.vcs.bazaar import Bazaar
from tests.lib import _test_path_to_file_url, _vcs_add, create_file, need_bzr
from tests.lib import (
_test_path_to_file_url, _vcs_add, create_file, is_bzr_installed, need_bzr,
)
@pytest.mark.skipif(
'TRAVIS' not in os.environ,
reason='Bazaar is only required under Travis')
def test_ensure_bzr_available():
"""Make sure that bzr is available when running in Travis."""
assert is_bzr_installed()
@need_bzr

View File

@ -801,6 +801,14 @@ def need_executable(name, check_cmd):
return wrapper
def is_bzr_installed():
try:
subprocess.check_output(('bzr', 'version', '--short'))
except OSError:
return False
return True
def need_bzr(fn):
return pytest.mark.bzr(need_executable(
'Bazaar', ('bzr', 'version', '--short')