def test_get_current_vcs_hash_no_git(self, monkeypatch): def fake_check_output(*args, **kwargs): raise OSError() monkeypatch.setattr(subprocess, 'check_output', fake_check_output) assert utils.get_current_vcs_hash() == ''
def test_get_current_vcs_hash_git_error(self, monkeypatch): def fake_check_output(*args, **kwargs): raise subprocess.CalledProcessError(0, '', '') monkeypatch.setattr(subprocess, 'check_output', fake_check_output) assert utils.get_current_vcs_hash() == ''
def test_get_current_vcs_hash(self, monkeypatch): def fake_check_output(*args, **kwargs): return b'thisisagithash' monkeypatch.setattr(subprocess, 'check_output', fake_check_output) assert utils.get_current_vcs_hash() == 'thisisagithash'