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. - Attributes Summary - cli- Get the command line interface function under test, can be overridden to test CLIs other than butler. - Methods Summary - command()- Get the click.Command being tested. - defaultExpected()- makeExpected(**kwargs)- run_command(inputs)- Use the LogCliRunner 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[, withTempFile])- 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()- Attributes Documentation - 
cli¶
- Get the command line interface function under test, can be overridden to test CLIs other than butler. 
 - Methods Documentation - 
static command()¶
- Get the click.Command being tested. 
 - 
static defaultExpected()¶
 - 
classmethod makeExpected(**kwargs)¶
 - 
run_command(inputs)¶
- Use the LogCliRunner 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. 
 
- 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. - Parameters: 
 - 
run_test(inputs, expectedKwargs, withTempFile=None)¶
- 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. - Returns the result object for inspection, e.g. sometimes it’s useful to be able to inpsect or print - result.output.- 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. 
- withTempFile : str, optional
- If not None, will run in a temporary directory and create a file with the given name, can be used with commands with parameters that require a file to exist. 
 - Returns: - result : click.testing.Result
- The result object produced by invocation of the command under test. 
 
- inputs : [
 - 
setUp()¶
 - 
test_help()¶
 
-