def test_github_vcs_info(monkeypatch): monkeypatch.setattr(vcs, 'locate_git', lambda: '.') monkeypatch.setattr( Repo, 'remotes', {'origin': MockOrigin('[email protected]:ceasaro/about_py.git')}) info = get_vcs_info() assert info.name == 'Git' assert info.origin_url == 'https://github.com/ceasaro/about_py'
def test_bitbucket_vcs_info(monkeypatch): monkeypatch.setattr(vcs, 'locate_git', lambda: '.') monkeypatch.setattr( Repo, 'remotes', {'origin': MockOrigin('[email protected]:ceasaro/scripts.git')}) info = get_vcs_info() assert info.name == 'Git' assert info.origin_url == 'https://bitbucket.org/ceasaro/scripts'
def get_vcs(self): try: return get_vcs_info() except AboutPyException as e: LOG.warn('no vcs detected. cause: {}'.format(e.message)) return {}
def test_no_vcs(monkeypatch): monkeypatch.setattr(vcs, 'locate_git', lambda: None) info = get_vcs_info() assert info.is_empty()