Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def returns_lexica_for_reuse(self):
actions = Lexicon(
changelog=Changelog.NEEDS_RELEASE,
version=VersionFile.NEEDS_BUMP,
tag=Tag.NEEDS_CUTTING,
)
found_actions, found_state = _mock_status(self)
assert found_actions == actions
# Spot check state, don't need to check whole thing...
assert found_state.branch == self._branch
assert found_state.latest_version == Version("1.1.1")
assert found_state.tags == [Version(x) for x in self._tags]
def all_okay(self):
_expect_actions(
self, Changelog.OKAY, VersionFile.OKAY, Tag.OKAY
)
def displays_status_output(self, _):
with _mock_context(self) as c:
_run_all(c)
output = sys.stdout.getvalue()
for action in (
Changelog.NEEDS_RELEASE,
VersionFile.NEEDS_BUMP,
Tag.NEEDS_CUTTING,
):
err = "Didn't see '{0}' text in status output!".format(action.name)
assert action.value in output, err
if release_type in (Release.BUGFIX, Release.FEATURE) and issues:
actions.changelog = Changelog.NEEDS_RELEASE
# Version file: simply whether version file equals the target version.
# TODO: corner case of 'version file is >1 release in the future', but
# that's still wrong, just would be a different 'bad' status output.
actions.version = VersionFile.OKAY
if state.current_version != state.expected_version:
actions.version = VersionFile.NEEDS_BUMP
# Git tag: similar to version file, except the check is existence of tag
# instead of comparison to file contents. We even reuse the
# 'expected_version' variable wholesale.
actions.tag = Tag.OKAY
if state.expected_version not in state.tags:
actions.tag = Tag.NEEDS_CUTTING
#
# Return
#
return actions, state
# just "up to date!" but "all set (will release 3 features & 5 bugs)"
actions.changelog = Changelog.OKAY
if release_type in (Release.BUGFIX, Release.FEATURE) and issues:
actions.changelog = Changelog.NEEDS_RELEASE
# Version file: simply whether version file equals the target version.
# TODO: corner case of 'version file is >1 release in the future', but
# that's still wrong, just would be a different 'bad' status output.
actions.version = VersionFile.OKAY
if state.current_version != state.expected_version:
actions.version = VersionFile.NEEDS_BUMP
# Git tag: similar to version file, except the check is existence of tag
# instead of comparison to file contents. We even reuse the
# 'expected_version' variable wholesale.
actions.tag = Tag.OKAY
if state.expected_version not in state.tags:
actions.tag = Tag.NEEDS_CUTTING
#
# Return
#
return actions, state