def test_unclean(self, tmpdir): create_project(tmpdir, 'git init') with pytest.raises(release.Error) as excinfo: release.verify(tmpdir.strpath) assert excinfo.value.args[0] == 'Git repo is not clean'
def test_no_setuppy(self, tmpdir): with pytest.raises(release.Error) as excinfo: release.verify(tmpdir.strpath) exc_msg = excinfo.value.args[0] assert 'No "setup.py" file found in source directory: ' in exc_msg assert exc_msg.endswith(tmpdir.strpath)
def publish(ctx, repo_dpath): """ Build packages, PyPi publish, GitHub push (run 3rd) """ try: releaselib.verify(repo_dpath) releaselib.publish(repo_dpath) except releaselib.Error as e: ctx.fail(str(e)) click.echo('Project built, uploaded, tagged, and pushed')
def test_no_git(self, tmpdir): setuppy = tmpdir.join('setup.py') setuppy.ensure(file=True) with pytest.raises(release.ExecuteError) as excinfo: release.verify(tmpdir.strpath) exc = excinfo.value assert exc.executable.endswith('git') assert exc.args[-2:] == ['status', '--porcelain'] assert 'Not a git repository' in exc.stderr
def status(ctx, repo_dpath): """ Show project status (run 1st) """ try: releaselib.verify(repo_dpath) status = releaselib.status(repo_dpath) except releaselib.Error as e: ctx.fail(str(e)) click.echo('Name: {}'.format(status.name)) click.echo('URL: {}'.format(status.url)) click.echo('Version: {}'.format(status.version))
def release(ctx, version, repo_dpath, source_dpath): """ Make a release (run 2nd) """ try: releaselib.verify(repo_dpath) config = read_config(repo_dpath) if not config: ctx.fail('no pyp.ini file found') release_date = dt.date.today() releaselib.release(repo_dpath, config, version, release_date) except releaselib.Error as e: ctx.fail(str(e)) click.echo( 'Release made. Review git repo changes, edit if needed, and commit.') click.echo('Next...run `pyp publish`.')