CliCmdTestBase

class lsst.daf.butler.tests.CliCmdTestBase

Bases: abc.ABC

A test case base that is used to verify click command functions import and call their respective script fucntions correctly.

Methods Summary

command Get the click.Command being tested.
defaultExpected
makeExpected(**kwargs)
run_command(inputs) Use the CliRunner with the mock environment variable set to execute a butler subcommand and parameters specified in inputs.
run_missing(inputs, expectedMsg) Run the subcommand specified in inputs and verify a failed outcome where exit code != 0 and an expected message has been written to stdout.
run_test(inputs, expectedKwargs) Run the subcommand specified in inputs and verify a successful outcome where exit code = 0 and the mock object has been called with the expected arguments.
setUp()
test_help()

Methods Documentation

classmethod command()

Get the click.Command being tested.

classmethod defaultExpected()
makeExpected(**kwargs)
run_command(inputs)

Use the CliRunner with the mock environment variable set to execute a butler subcommand and parameters specified in inputs.

Parameters:
inputs : [str]

A list of strings that begins with the subcommand name and is followed by arguments, option keys and option values.

Returns:
result : click.testing.Result

The Result object contains the results from calling self.runner.invoke.

run_missing(inputs, expectedMsg)

Run the subcommand specified in inputs and verify a failed outcome where exit code != 0 and an expected message has been written to stdout.

Parameters:
inputs : [str]

A list of strings that begins with the subcommand name and is followed by arguments, option keys and option values.

expectedMsg : str

An error message that should be present in stdout after running the subcommand.

run_test(inputs, expectedKwargs)

Run the subcommand specified in inputs and verify a successful outcome where exit code = 0 and the mock object has been called with the expected arguments.

Parameters:
inputs : [str]

A list of strings that begins with the subcommand name and is followed by arguments, option keys and option values.

expectedKwargs : dict [str, str]

The arguments that the subcommand function is expected to have been called with. Keys are the argument name and values are the argument value.

setUp()
test_help()