def test_git_clone_fail(self):
git_url = 'https://github.com/quiltdata/testdata.git'
def mock_git_clone(cmd):
# test git command
assert len(cmd) == 6
assert cmd[:5] == ['git', 'clone', '-q', '--depth=1', git_url]
# fake git clone fail
raise Exception()
with patch('subprocess.check_call', mock_git_clone):
with self.assertRaises(command.CommandException):
command.build('user/pkg__test_git_clone_fail', git_url)
# TODO: running -n (pytest-xdist) there's leaky state and can throw
# either ImportError: cannot import name or ModuleNotFoundError
with assertRaisesRegex(self, Exception, r'cannot import|not found|No module named|Could not find'):
from quilt.data.user import pkg__test_git_clone_fail
评论列表
文章目录