def test_get_installed_version(fake_vcs): with pytest.raises(VersionNotInstalledError): get_installed_version(fake_vcs) version_path = _get_version_path(fake_vcs) with open(version_path, 'w') as f: f.write('testing') assert get_installed_version(fake_vcs) == 'testing'
def cli(ctx): git = GitVcs() if ctx.args[0] != 'init': try: version = get_installed_version(git) except VersionNotInstalledError: click.echo('Please run `eci init` first.') ctx.abort() if version != easyci.__version__: click.echo('EasyCI version mismatch. Please rerun `eci init`.') ctx.abort() ctx.obj = dict() ctx.obj['vcs'] = git