def release(part): # Perform any pre-flight checks git_check_master() git_check_remote() # _test_all() returns the number of failed tests, # so when _test_all() is true, there were failed tests. if _test_all(): print_failure_message( 'Cannot release if tests do not pass.') raise SystemExit(1) # Bump the version, create a bump commit, and tag version_bump(part) version = subprocess.check_output( ['git', 'describe', '--abbrev=0', '--tags']).strip() print( 'Created new commit and tag for version bump. ' 'Use `git reset --hard HEAD~1` to rollback the commit, ' 'and `git tag -d {}` to rollback the tag.' .format(version)) # Reload setup_dict to pickup new metadata.version reload(setup) # Build the pip package, upload to PyPI, and push print( 'Begin packaging and uploading for {}'. format(metadata.version)) upload() subprocess.check_call(['git', 'push']) subprocess.check_call(['git', 'push', '--tags'])
def test_all(): """Perform a style check and run all unit tests.""" retcode = _test_all() if retcode == 0: print_passed() else: print_failed() raise SystemExit(retcode)
def commit(): """Commit only if all the tests pass.""" if _test_all() == 0: subprocess.check_call(['git', 'commit']) else: print_failure_message('\nTests failed, not committing.')
def commit(): """Commit only if all the tests pass.""" if _test_all() == 0: subprocess.check_call(["git", "commit"]) else: print_failure_message("\nTests failed, not committing.")