Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _run(
self,
flag="-S",
file_="ssh_config/runtime.conf",
tasks="runtime-ssh-config",
):
with cd(support):
# Relies on asserts within the task, which will bubble up as
# it's executed in-process
cmd = "fab -c runtime_fabfile {} {} -H runtime {}"
program.run(cmd.format(flag, file_, tasks))
def can_be_set_via_env(self, reset_environ):
os.environ["INVOKE_RUNTIME_CONFIG"] = "yaml/invoke.yaml"
with cd("configs"):
expect("-c runtime mytask")
def loads_fabric_config_files_not_invoke_ones(self):
for type_ in ("yaml", "yml", "json", "py"):
with cd(os.path.join(support, "{}_conf".format(type_))):
# This task, in each subdir, expects data present in a
# fabric. nearby to show up in the config.
program.run("fab expect-conf-value")
def core_help_doesnt_get_mad_if_loading_fails(self):
# Expects no tasks.py in root of FS
with cd(ROOT):
stdout, _ = run("--help")
assert "Usage: " in stdout
def config_mutation_not_preserved(self):
with cd(support):
program.run("fab -H host1,host2 expect-mutation-to-fail")
def loads_fabfile_not_tasks(self):
"Loads fabfile.py, not tasks.py"
with cd(support):
expect(
"--list",
"""
Available tasks:
def basic_pre_and_post_tasks_still_work(self):
with cd(support):
# Sanity
expect("first", "First!\n")
expect("third", "Third!\n")
# Real test
expect("second", "First!\nSecond!\nThird!\n")
def build(ctx, builder="html", options=""):
"""Build docs with sphinx-build"""
sourcedir = ctx.config.sphinx.sourcedir
destdir = Path(ctx.config.sphinx.destdir or "build")/builder
destdir = destdir.abspath()
with cd(sourcedir):
destdir_relative = Path(".").relpathto(destdir)
command = "sphinx-build {opts} -b {builder} {sourcedir} {destdir}" \
.format(builder=builder, sourcedir=".",
destdir=destdir_relative, opts=options)
ctx.run(command)