Usage¶
Running workflows, writing scripts, calling cijoe from any Python module. The testrunner script and pytest-plugin.
Environment Variables¶
There are a couple of environmetn variables which change the behaviour of
cijoe. Primarily the behavior of the cijoe
command-line tool.
CIJOE_DISABLE_SSH_ENV_INJECT
, when this is set, then environment variables passed tocijoe.run(..., env={your: vars})
won’t be pased on to the SSH transport.CIJOE_DEFAULT_CONFIG
,, when set, the value will be used as default value for the command-line-c/--config
argument.CIJOE_DEFAULT_WORKFLOW
, when set, the value will be used as default value for the command-line-w/--workflow
argument.
Command-line¶
The command-line tool is aptly named cijoe
.
Workflows¶
…
Testrunner¶
The script… and the pytest-plugin…
cijoe pytest-plugin¶
The plugin provides a cijoe-instance readily available as a test-fixture, setup per test with a nodeid-defined output-directory. For example:
def test_foo(cijoe):
err, _ = cijoe.run("hostname")
asssert not err
To provide the cijoe-instance a configuration and output directory must be provided. These are given via pytest, e.g.:
pytest --config default.toml --output /tmp/foo
In case no arguments are provided, defaults are used.
- cijoe.pytest_plugin.hooks_and_fixtures.cijoe(request)¶
Provides a cijoe-instance, initialized with the pytest-options:
--config
, and--output
and with a per-test customization of the output directory.
- cijoe.pytest_plugin.hooks_and_fixtures.pytest_addoption(parser)¶
Add options
--config
and--output
to pytest, these will be used for the instantiation of cijoe.
- cijoe.pytest_plugin.hooks_and_fixtures.pytest_configure(config)¶
Initializes the cijoe instance using pytest-options
--config
and--output
The cijoe-instance is stored in
pytest.cijoe_instance
, this might appear as bad form. However, it is a common pytest-pattern for enabling access to state otherwise only accessible to tests and fixtures.Why would this be needed? Well, for large paramaterizations, e.g. to generate input to pytest.mark.parametrize(). Here it is convenient to be able to access the same cijoe instance, and for example generate test-parametrization based on the content of the cijoe-configuration.
- cijoe.pytest_plugin.hooks_and_fixtures.pytest_terminal_summary(terminalreporter, exitstatus, config)¶
Prints out a notice that cijoe is beeing used along with the values of the
--config
and--output
options.