How to use the invoke.util.cd function in invoke

To help you get started, we’ve selected a few invoke examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fabric / fabric / tests / main.py View on Github external
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))
github pyinvoke / invoke / tests / program.py View on Github external
def can_be_set_via_env(self, reset_environ):
                os.environ["INVOKE_RUNTIME_CONFIG"] = "yaml/invoke.yaml"
                with cd("configs"):
                    expect("-c runtime mytask")
github fabric / fabric / tests / main.py View on Github external
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")
github pyinvoke / invoke / tests / program.py View on Github external
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
github fabric / fabric / tests / main.py View on Github external
def config_mutation_not_preserved(self):
            with cd(support):
                program.run("fab -H host1,host2 expect-mutation-to-fail")
github fabric / fabric / tests / main.py View on Github external
def loads_fabfile_not_tasks(self):
            "Loads fabfile.py, not tasks.py"
            with cd(support):
                expect(
                    "--list",
                    """
Available tasks:
github fabric / fabric / tests / main.py View on Github external
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")
github behave / behave / tasks / docs.py View on Github external
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)