Describe the bug
@davidhyman : All PRs were merged to master
. Nonetheless, Tests are failing in CI preventing any new release.
To Reproduce
#!/bin/bash -eo pipefail
git config user.email "[email protected]"
git config user.name "Your Name"
pipenv run pytest --junitxml=test-reports/results.xml
pipenv run green -r src
============================= test session starts ==============================
platform linux -- Python 3.7.0, pytest-5.4.1, py-1.10.0, pluggy-0.13.1
rootdir: /home/circleci/repo
plugins: html-2.1.1, metadata-1.11.0, cov-2.8.1
collecting ... collected 58 items
src/auto_version/tests/test_autoversion.py FEFEFEFEFEFEFEFEFFEFE........ [ 32%]
.....FFFFFE............................. [100%]
==================================== ERRORS ====================================
__________________ ERROR at teardown of TestBumps.test_build ___________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_build>
self.call(set_to="19.99.0")
test_autoversion.py:32:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
________________ ERROR at teardown of TestBumps.test_bump_major ________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_bump_major>
self.call(set_to="19.99.0")
test_autoversion.py:32:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
________________ ERROR at teardown of TestBumps.test_bump_news _________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_bump_news>
self.call(set_to="19.99.0")
test_autoversion.py:32:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
________________ ERROR at teardown of TestBumps.test_bump_patch ________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_bump_patch>
self.call(set_to="19.99.0")
test_autoversion.py:32:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
_____________ ERROR at teardown of TestBumps.test_custom_field_set _____________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_custom_field_set>
self.call(set_to="19.99.0")
test_autoversion.py:32:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
___________________ ERROR at teardown of TestBumps.test_dev ____________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_dev>
self.call(set_to="19.99.0")
test_autoversion.py:32:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
________________ ERROR at teardown of TestBumps.test_end_to_end ________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_end_to_end>
self.call(set_to="19.99.0")
test_autoversion.py:32:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
______ ERROR at teardown of TestBumps.test_increment_existing_prerelease _______
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_increment_existing_prerelease>
self.call(set_to="19.99.0")
test_autoversion.py:32:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
_____________ ERROR at teardown of TestBumps.test_non_release_bump _____________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_non_release_bump>
self.call(set_to="19.99.0")
test_autoversion.py:32:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
____________ ERROR at teardown of TestBumps.test_simple_config_bump ____________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_simple_config_bump>
self.call(set_to="19.99.0")
test_autoversion.py:32:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
_________________ ERROR at teardown of TestVCSTags.test_to_tag _________________
cls = <class 'auto_version.tests.test_autoversion.TestVCSTags'>
@classmethod
def tearDownClass(cls):
cls.call(set_to="19.99.0")
test_autoversion.py:233:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
----------------------------- Captured stderr call -----------------------------
fatal: tag 'release/4.5.6' already exists
=================================== FAILURES ===================================
_____________________________ TestBumps.test_build _____________________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_build>
def test_build(self):
# can't just tag a build onto something that's already a release version
self.call(set_to="19.99.0+build.1")
test_autoversion.py:83:
set_to = '19.99.0+build.1', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build='build.1')
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
__________________________ TestBumps.test_bump_major ___________________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_bump_major>
def test_bump_major(self):
old, new, updates = self.call(bump="major", release=True)
test_autoversion.py:47:
set_to = None, commit_count_as = None, release = True, bump = 'major'
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = {'major', 'patch'}
new_version = Version(major=20, minor=0, patch=0, prerelease=None, build=None)
overrides = {}
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
___________________________ TestBumps.test_bump_news ___________________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_bump_news>
def test_bump_news(self):
old, new, updates = self.call(enable_file_triggers=True, release=True)
test_autoversion.py:59:
set_to = None, commit_count_as = None, release = True, bump = None, lock = None
enable_file_triggers = True, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = {'minor', 'patch'}
new_version = Version(major=19, minor=100, patch=0, prerelease=None, build=None)
overrides = {}
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
__________________________ TestBumps.test_bump_patch ___________________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_bump_patch>
def test_bump_patch(self):
old, new, updates = self.call(bump="patch", release=True)
test_autoversion.py:35:
set_to = None, commit_count_as = None, release = True, bump = 'patch'
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = {'patch'}
new_version = Version(major=19, minor=99, patch=1, prerelease=None, build=None)
overrides = {}
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
_______________________ TestBumps.test_custom_field_set ________________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_custom_field_set>
def test_custom_field_set(self):
old, new, updates = self.call(UNRELATED_STRING="apple")
test_autoversion.py:128:
set_to = None, commit_count_as = None, release = None, bump = None, lock = None
enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {'UNRELATED_STRING': 'apple'}, all_data = {}
last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
______________________________ TestBumps.test_dev ______________________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_dev>
old, new, updates = self.call(bump="prerelease")
test_autoversion.py:71:
set_to = None, commit_count_as = None, release = None, bump = 'prerelease'
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = {'patch', 'prerelease'}
new_version = Version(major=19, minor=99, patch=1, prerelease='dev.1', build=None)
overrides = {}
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
__________________________ TestBumps.test_end_to_end ___________________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_end_to_end>
def test_end_to_end(self):
test_autoversion.py:116:
set_to = None, commit_count_as = None, release = None, bump = 'major'
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = {'major', 'patch'}
new_version = Version(major=20, minor=0, patch=0, prerelease='dev.1', build=None)
overrides = {}
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
_________________ TestBumps.test_increment_existing_prerelease _________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_increment_existing_prerelease>
def test_increment_existing_prerelease(self):
old, new, updates = self.call(set_to="1.2.3-RC.1")
test_autoversion.py:110:
set_to = '1.2.3-RC.1', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=1, minor=2, patch=3, prerelease='RC.1', build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
_________________________ TestBumps.test_invalid_bump __________________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_invalid_bump>
self.call(set_to="19.99.0")
test_autoversion.py:32:
set_to = '19.99.0', commit_count_as = None, release = None, bump = None
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = set()
new_version = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
_______________________ TestBumps.test_non_release_bump ________________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_non_release_bump>
def test_non_release_bump(self):
old, new, updates = self.call(bump="minor")
test_autoversion.py:95:
set_to = None, commit_count_as = None, release = None, bump = 'minor'
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = {'minor', 'patch'}
new_version = Version(major=19, minor=100, patch=0, prerelease='dev.1', build=None)
overrides = {}
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
______________________ TestBumps.test_simple_config_bump _______________________
self = <auto_version.tests.test_autoversion.TestBumps testMethod=test_simple_config_bump>
def test_simple_config_bump(self):
old, new, updates = self.call(config_path="simple.toml", bump="minor")
test_autoversion.py:122:
set_to = None, commit_count_as = None, release = None, bump = 'minor'
lock = None, enable_file_triggers = None, incr_from_release = None
config_path = 'simple.toml', persist_from = ['source'], persist_to = ['source']
dry_run = None, extra_updates = {}, all_data = {}, last_release_semver = None
current_semver = Version(major=19, minor=99, patch=0, prerelease=None, build=None)
release_commit = None, triggers = {'minor', 'patch'}
new_version = Version(major=19, minor=100, patch=0, prerelease='dev.1', build=None)
overrides = {}
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
____________________ TestVCSTags.test_from_ancestor_release ____________________
self = <auto_version.tests.test_autoversion.TestVCSTags testMethod=test_from_ancestor_release>
def test_from_ancestor_release(self):
bumped = "4.5.6"
old, new, updates = self.call(
persist_from=[Constants.FROM_VCS_PREVIOUS_RELEASE]
test_autoversion.py:266:
set_to = None, commit_count_as = None, release = None, bump = None, lock = None
enable_file_triggers = None, incr_from_release = None
config_path = 'example.toml', persist_from = ['vcs-prev-release']
persist_to = ['source'], dry_run = None, extra_updates = {}, all_data = {}
last_release_semver = None
current_semver = Version(major=4, minor=5, patch=6, prerelease=None, build=None)
release_commit = 'c510bed844bb936f99582e40e60413340e5876ab', triggers = set()
new_version = Version(major=4, minor=5, patch=6, prerelease=None, build=None)
def main(
set_to=None,
commit_count_as=None,
release=None,
bump=None,
lock=None,
enable_file_triggers=None,
incr_from_release=None,
config_path=None,
persist_from=None,
persist_to=None,
dry_run=None,
**extra_updates
):
"""Main workflow.
Load config from cli and file
Detect "bump triggers" - things that cause a version increment
Find the current version
Create a new version
Write out new version and any other requested variables
:param set_to: explicitly set semver to this version string
:param commit_count_as: uses the commit count for the specified sigfig
:param release: marks with a production flag
just sets a single flag as per config
:param bump: string indicating major/minor/patch
more significant bumps will zero the less significant ones
:param lock: locks the version string for the next call to autoversion
lock only removed if a version bump would have occurred
:param enable_file_triggers: whether to enable bumping based on file triggers
bumping occurs once if any file(s) exist that match the config
:param incr_from_release: dynamically generates the bump by comparing the
proposed triggers for the current version, with the significance of the previous release
to ensure e.g. adding new major changes to a prerelease should probably trigger a new major version
specifically, the bump is:
if (max trigger sigfig) > (max sigfig since release):
(max trigger sigfig)
else
(min trigger sigfig)
:param config_path: path to config file
:param extra_updates:
:return:
"""
updates = {}
persist_to = persist_to or [Constants.TO_SOURCE]
persist_from = persist_from or [Constants.FROM_SOURCE]
load_config(config_path)
all_data = {}
last_release_semver = None
if incr_from_release:
if (Constants.FROM_VCS_PREVIOUS_VERSION in persist_from) or (
Constants.FROM_VCS_PREVIOUS_RELEASE in persist_from
):
last_release_semver = get_dvcs_previous_release_semver()
else:
last_release_semver = get_dvcs_repo_latest_release_semver()
_LOG.debug("found previous full release: %s", last_release_semver)
current_semver = get_current_version(persist_from)
release_commit = get_dvcs_commit_for_version(current_semver, persist_from)
triggers = get_all_triggers(bump, enable_file_triggers, release_commit)
updates.update(get_lock_behaviour(triggers, all_data, lock))
updates.update(get_dvcs_info())
new_version = current_semver
if set_to:
_LOG.debug("setting version directly: %s", set_to)
# parse it - validation failure will raise a ValueError
new_version = semver.parse_version_info(set_to)
if not lock:
warnings.warn(
"After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?",
UserWarning,
)
elif triggers:
# use triggers if the version is not set directly
_LOG.debug("auto-incrementing version (triggers: %s)", triggers)
overrides = get_overrides(updates, commit_count_as)
new_version = utils.make_new_semver(
current_semver, last_release_semver, triggers, **overrides
)
release_string = semver.finalize_version(str(new_version))
release_version = semver.parse_version_info(release_string)
if release:
new_version = release_version
updates[Constants.RELEASE_FIELD] = config.RELEASED_VALUE
updates[Constants.VERSION_FIELD] = release_string
updates[Constants.VERSION_STRICT_FIELD] = release_string
else:
updates[Constants.VERSION_FIELD] = str(new_version)
updates[Constants.VERSION_STRICT_FIELD] = release_string
# write out the individual parts of the version
updates.update(new_version._asdict())
E AttributeError: 'Version' object has no attribute '_asdict'
../auto_version_tool.py:478: AttributeError
____________________ TestVCSTags.test_from_ancestor_version ____________________
self = <auto_version.tests.test_autoversion.TestVCSTags testMethod=test_from_ancestor_version>
def setUp(self):
cmd = "git tag release/4.5.6"
subprocess.check_call(shlex.split(cmd))
test_autoversion.py:237:
popenargs = (['git', 'tag', 'release/4.5.6'],), kwargs = {}, retcode = 128
cmd = ['git', 'tag', 'release/4.5.6']
def check_call(*popenargs, **kwargs):
"""Run command with arguments. Wait for command to complete. If
the exit code was zero then return, otherwise raise
CalledProcessError. The CalledProcessError object will have the
return code in the returncode attribute.
The arguments are the same as for the call function. Example:
check_call(["ls", "-l"])
"""
retcode = call(*popenargs, **kwargs)
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '['git', 'tag', 'release/4.5.6']' returned non-zero exit status 128.
/usr/local/lib/python3.7/subprocess.py:328: CalledProcessError
----------------------------- Captured stderr call -----------------------------
fatal: tag 'release/4.5.6' already exists
___________________ TestVCSTags.test_from_latest_of_all_time ___________________
self = <auto_version.tests.test_autoversion.TestVCSTags testMethod=test_from_latest_of_all_time>
def setUp(self):
cmd = "git tag release/4.5.6"
subprocess.check_call(shlex.split(cmd))
test_autoversion.py:237:
popenargs = (['git', 'tag', 'release/4.5.6'],), kwargs = {}, retcode = 128
cmd = ['git', 'tag', 'release/4.5.6']
def check_call(*popenargs, **kwargs):
"""Run command with arguments. Wait for command to complete. If
the exit code was zero then return, otherwise raise
CalledProcessError. The CalledProcessError object will have the
return code in the returncode attribute.
The arguments are the same as for the call function. Example:
check_call(["ls", "-l"])
"""
retcode = call(*popenargs, **kwargs)
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '['git', 'tag', 'release/4.5.6']' returned non-zero exit status 128.
/usr/local/lib/python3.7/subprocess.py:328: CalledProcessError
----------------------------- Captured stderr call -----------------------------
fatal: tag 'release/4.5.6' already exists
_______________ TestVCSTags.test_from_latest_of_all_time_release _______________
self = <auto_version.tests.test_autoversion.TestVCSTags testMethod=test_from_latest_of_all_time_release>
def setUp(self):
cmd = "git tag release/4.5.6"
subprocess.check_call(shlex.split(cmd))
test_autoversion.py:237:
popenargs = (['git', 'tag', 'release/4.5.6'],), kwargs = {}, retcode = 128
cmd = ['git', 'tag', 'release/4.5.6']
def check_call(*popenargs, **kwargs):
"""Run command with arguments. Wait for command to complete. If
the exit code was zero then return, otherwise raise
CalledProcessError. The CalledProcessError object will have the
return code in the returncode attribute.
The arguments are the same as for the call function. Example:
check_call(["ls", "-l"])
"""
retcode = call(*popenargs, **kwargs)
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '['git', 'tag', 'release/4.5.6']' returned non-zero exit status 128.
/usr/local/lib/python3.7/subprocess.py:328: CalledProcessError
----------------------------- Captured stderr call -----------------------------
fatal: tag 'release/4.5.6' already exists
___________________________ TestVCSTags.test_to_tag ____________________________
self = <auto_version.tests.test_autoversion.TestVCSTags testMethod=test_to_tag>
def setUp(self):
cmd = "git tag release/4.5.6"
subprocess.check_call(shlex.split(cmd))
test_autoversion.py:237:
popenargs = (['git', 'tag', 'release/4.5.6'],), kwargs = {}, retcode = 128
cmd = ['git', 'tag', 'release/4.5.6']
def check_call(*popenargs, **kwargs):
"""Run command with arguments. Wait for command to complete. If
the exit code was zero then return, otherwise raise
CalledProcessError. The CalledProcessError object will have the
return code in the returncode attribute.
The arguments are the same as for the call function. Example:
check_call(["ls", "-l"])
"""
retcode = call(*popenargs, **kwargs)
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '['git', 'tag', 'release/4.5.6']' returned non-zero exit status 128.
/usr/local/lib/python3.7/subprocess.py:328: CalledProcessError
----------------------------- Captured stderr call -----------------------------
fatal: tag 'release/4.5.6' already exists
=============================== warnings summary ===============================
.venv/lib/python3.7/site-packages/_pytest/junitxml.py:417
/home/circleci/repo/.venv/lib/python3.7/site-packages/_pytest/junitxml.py:417: PytestDeprecationWarning: The 'junit_family' default value will change to 'xunit2' in pytest 6.0.
Add 'junit_family=xunit1' to your pytest.ini file to keep the current format in future versions of pytest and silence this warning.
_issue_warning_captured(deprecated.JUNIT_XML_DEFAULT_FAMILY, config.hook, 2)
src/auto_version/tests/test_autoversion.py:3
/home/circleci/repo/src/auto_version/tests/test_autoversion.py:3: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
src/auto_version/tests/test_autoversion.py: 47 tests with warnings
/home/circleci/repo/src/auto_version/utils.py:19: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
return semver.parse_version_info(text)
src/auto_version/tests/test_autoversion.py: 45 tests with warnings
/home/circleci/repo/src/auto_version/utils.py:50: DeprecationWarning: Function 'semver.finalize_version' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use the respective 'semver.Version.finalize_version' instead.
release_versions = {semver.finalize_version(version) for version in versions}
src/auto_version/tests/test_autoversion.py: 23 tests with warnings
/home/circleci/repo/src/auto_version/utils.py:66: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
return semver.parse_version_info(result)
src/auto_version/tests/test_autoversion.py: 14 tests with warnings
/home/circleci/repo/src/auto_version/auto_version_tool.py:452: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
new_version = semver.parse_version_info(set_to)
src/auto_version/tests/test_autoversion.py: 14 tests with warnings
/home/circleci/repo/src/auto_version/auto_version_tool.py:456: UserWarning: After setting version manually, does it need locking for a CI flow, to avoid an extraneous increment?
UserWarning,
src/auto_version/tests/test_autoversion.py: 23 tests with warnings
/home/circleci/repo/src/auto_version/auto_version_tool.py:466: DeprecationWarning: Function 'semver.finalize_version' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use the respective 'semver.Version.finalize_version' instead.
release_string = semver.finalize_version(str(new_version))
src/auto_version/tests/test_autoversion.py: 23 tests with warnings
/home/circleci/repo/src/auto_version/auto_version_tool.py:467: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
release_version = semver.parse_version_info(release_string)
src/auto_version/tests/test_autoversion.py::TestBumps::test_bump_major
src/auto_version/tests/test_autoversion.py::TestBumps::test_end_to_end
/home/circleci/repo/src/auto_version/utils.py:150: DeprecationWarning: Function 'semver.bump_major' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use the respective 'semver.Version.bump_major' instead.
str(current_semver), **get_token_args(bump_sigfig)
src/auto_version/tests/test_autoversion.py: 11 tests with warnings
/home/circleci/repo/src/auto_version/utils.py:158: DeprecationWarning: Function 'semver.bump_prerelease' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use the respective 'semver.Version.bump_prerelease' instead.
version_string, token=config.PRERELEASE_TOKEN
src/auto_version/tests/test_autoversion.py: 14 tests with warnings
/home/circleci/repo/src/auto_version/utils.py:162: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
version_info = semver.parse_version_info(version_string)
src/auto_version/tests/test_autoversion.py::TestBumps::test_bump_news
src/auto_version/tests/test_autoversion.py::TestBumps::test_non_release_bump
src/auto_version/tests/test_autoversion.py::TestBumps::test_simple_config_bump
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_candidate_bump_with_history_more
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_release_bump
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_release_bump_with_history
/home/circleci/repo/src/auto_version/utils.py:150: DeprecationWarning: Function 'semver.bump_minor' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use the respective 'semver.Version.bump_minor' instead.
str(current_semver), **get_token_args(bump_sigfig)
src/auto_version/tests/test_autoversion.py::TestBumps::test_bump_patch
src/auto_version/tests/test_autoversion.py::TestBumps::test_dev
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_no_history_bump
/home/circleci/repo/src/auto_version/utils.py:150: DeprecationWarning: Function 'semver.bump_patch' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use the respective 'semver.Version.bump_patch' instead.
str(current_semver), **get_token_args(bump_sigfig)
src/auto_version/tests/test_autoversion.py::TestUtils::test_is_release
/home/circleci/repo/src/auto_version/tests/test_autoversion.py:134: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
self.assertTrue(utils.is_release(semver.parse_version_info("1.2.3")))
src/auto_version/tests/test_autoversion.py::TestUtils::test_is_release
/home/circleci/repo/src/auto_version/tests/test_autoversion.py:135: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
self.assertFalse(utils.is_release(semver.parse_version_info("1.2.3-RC.1")))
src/auto_version/tests/test_autoversion.py::TestUtils::test_is_release
/home/circleci/repo/src/auto_version/tests/test_autoversion.py:136: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
self.assertFalse(utils.is_release(semver.parse_version_info("1.2.3+abc")))
src/auto_version/tests/test_autoversion.py::TestUtils::test_semver_diff
src/auto_version/tests/test_autoversion.py::TestUtils::test_semver_diff
/home/circleci/repo/src/auto_version/tests/test_autoversion.py:158: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
semver.parse_version_info("1.2.3"), semver.parse_version_info("1.3.5")
src/auto_version/tests/test_autoversion.py::TestUtils::test_semver_diff
/home/circleci/repo/src/auto_version/tests/test_autoversion.py:164: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
semver.parse_version_info("1.2.3"),
src/auto_version/tests/test_autoversion.py::TestUtils::test_semver_diff
/home/circleci/repo/src/auto_version/tests/test_autoversion.py:165: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
semver.parse_version_info("1.2.4-RC.1"),
src/auto_version/tests/test_autoversion.py::TestUtils::test_semver_diff
src/auto_version/tests/test_autoversion.py::TestUtils::test_semver_diff
/home/circleci/repo/src/auto_version/tests/test_autoversion.py:171: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
semver.parse_version_info("1.2.3"), semver.parse_version_info("1.2.3")
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_candidate_bump_with_history_less
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_candidate_bump_with_history_more
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_candidate_bump_with_history_same
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_release_bump_with_history
/home/circleci/repo/src/auto_version/tests/test_autoversion.py:185: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
previous = semver.parse_version_info(previous) if previous else None
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_candidate_bump_with_history_less
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_candidate_bump_with_history_more
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_candidate_bump_with_history_same
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_no_history_bump
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_no_history_pre_bump
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_release_bump
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_release_bump_with_history
/home/circleci/repo/src/auto_version/tests/test_autoversion.py:190: DeprecationWarning: Function 'semver.parse_version_info' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use 'semver.Version.parse' instead.
semver.parse_version_info(current), previous, bumps
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_candidate_bump_with_history_less
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_candidate_bump_with_history_same
src/auto_version/tests/test_autoversion.py::TestNewSemVerLogic::test_no_history_pre_bump
/home/circleci/repo/src/auto_version/utils.py:150: DeprecationWarning: Function 'semver.bump_prerelease' is deprecated. Deprecated since version 2.10.0. This function will be removed in semver 3. Use the respective 'semver.Version.bump_prerelease' instead.
str(current_semver), **get_token_args(bump_sigfig)
-- Docs: https://docs.pytest.org/en/latest/warnings.html
------- generated xml file: /home/circleci/repo/test-reports/results.xml -------
=========================== short test summary info ============================
FAILED src/auto_version/tests/test_autoversion.py::TestBumps::test_build - At...
FAILED src/auto_version/tests/test_autoversion.py::TestBumps::test_bump_major
FAILED src/auto_version/tests/test_autoversion.py::TestBumps::test_bump_news
FAILED src/auto_version/tests/test_autoversion.py::TestBumps::test_bump_patch
FAILED src/auto_version/tests/test_autoversion.py::TestBumps::test_custom_field_set
FAILED src/auto_version/tests/test_autoversion.py::TestBumps::test_dev - Attr...
FAILED src/auto_version/tests/test_autoversion.py::TestBumps::test_end_to_end
FAILED src/auto_version/tests/test_autoversion.py::TestBumps::test_increment_existing_prerelease
FAILED src/auto_version/tests/test_autoversion.py::TestBumps::test_invalid_bump
FAILED src/auto_version/tests/test_autoversion.py::TestBumps::test_non_release_bump
FAILED src/auto_version/tests/test_autoversion.py::TestBumps::test_simple_config_bump
FAILED src/auto_version/tests/test_autoversion.py::TestVCSTags::test_from_ancestor_release
FAILED src/auto_version/tests/test_autoversion.py::TestVCSTags::test_from_ancestor_version
FAILED src/auto_version/tests/test_autoversion.py::TestVCSTags::test_from_latest_of_all_time
FAILED src/auto_version/tests/test_autoversion.py::TestVCSTags::test_from_latest_of_all_time_release
FAILED src/auto_version/tests/test_autoversion.py::TestVCSTags::test_to_tag
ERROR src/auto_version/tests/test_autoversion.py::TestBumps::test_build - Att...
ERROR src/auto_version/tests/test_autoversion.py::TestBumps::test_bump_major
ERROR src/auto_version/tests/test_autoversion.py::TestBumps::test_bump_news
ERROR src/auto_version/tests/test_autoversion.py::TestBumps::test_bump_patch
ERROR src/auto_version/tests/test_autoversion.py::TestBumps::test_custom_field_set
ERROR src/auto_version/tests/test_autoversion.py::TestBumps::test_dev - Attri...
ERROR src/auto_version/tests/test_autoversion.py::TestBumps::test_end_to_end
ERROR src/auto_version/tests/test_autoversion.py::TestBumps::test_increment_existing_prerelease
ERROR src/auto_version/tests/test_autoversion.py::TestBumps::test_non_release_bump
ERROR src/auto_version/tests/test_autoversion.py::TestBumps::test_simple_config_bump
ERROR src/auto_version/tests/test_autoversion.py::TestVCSTags::test_to_tag - ...
============ 16 failed, 42 passed, 250 warnings, 11 errors in 2.97s ============
Exited with code exit status 1
CircleCI received exit code 1