Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_version_is_newer(requests):
version = __version__.replace("rc", "-rc")
newer_version = semver.bump_minor(version)
requests.get.return_value = FakeResponse(
200,
"http://someplace//usage/latest/",
{"version": __version__, "up_to_date": False}
)
latest_version = check_newer_version(command="init")
assert latest_version == __version__
def test_version_is_not_newer(requests):
requests.get.return_value = FakeResponse(
200,
"https://releases.chaostoolkit.org/latest",
{"version": __version__, "up_to_date": True}
)
latest_version = check_newer_version(command="init")
assert latest_version is None
configure_logger(
verbose=verbose, log_file=log_file, log_format=log_format,
context_id=str(uuid.uuid4()))
subcommand = ctx.invoked_subcommand
# make it nicer for going through the log file
logger.debug("#" * 79)
logger.debug("Running command '{}'".format(subcommand))
ctx.obj = {}
ctx.obj["settings_path"] = click.format_filename(settings)
logger.debug("Using settings file '{}'".format(ctx.obj["settings_path"]))
if not no_version_check:
check_newer_version(command=subcommand)
if change_dir:
logger.warning("Moving to {d}".format(d=change_dir))
os.chdir(change_dir)