LogCliRunner¶
- 
class lsst.daf.butler.cli.utils.LogCliRunner(charset=None, env=None, echo_stdin=False, mix_stderr=True)¶
- Bases: - click.testing.CliRunner- A test runner to use when the logging system will be initialized by code under test, calls CliLog.resetLog(), which undoes any logging setup that was done with the CliLog interface. - lsst.log modules can not be set back to an uninitialized state (python logging modules can be set back to NOTSET), instead they are set to - CliLog.defaultLsstLogLevel.- Methods Summary - get_default_prog_name(cli)- Given a command object it will return the default program name for it. - invoke(*args, **kwargs)- Invokes a command in an isolated environment. - isolated_filesystem()- A context manager that creates a temporary folder and changes the current working directory to it for isolated filesystem tests. - isolation([input, env, color])- A context manager that sets up the isolation for invoking of a command line tool. - make_env([overrides])- Returns the environment overrides for invoking a script. - Methods Documentation - 
get_default_prog_name(cli)¶
- Given a command object it will return the default program name for it. The default is the - nameattribute or- "root"if not set.
 - 
invoke(*args, **kwargs) → Any¶
- Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the - extrakeyword arguments are passed to the- main()function of the command.- This returns a - Resultobject.- New in version 3.0: The - catch_exceptionsparameter was added.- Changed in version 3.0: The result object now has an - exc_infoattribute with the traceback if available.- New in version 4.0: The - colorparameter was added.- Parameters: - cli – the command to invoke
- args – the arguments to invoke. It may be given as an iterable
or a string. When given as string it will be interpreted
as a Unix shell command. More details at
shlex.split().
- input – the input data for sys.stdin.
- env – the environment overrides.
- catch_exceptions – Whether to catch any other exceptions than
SystemExit.
- extra – the keyword arguments to pass to main().
- color – whether the output should contain color codes. The application can still override this explicitly.
 
 - 
isolated_filesystem()¶
- A context manager that creates a temporary folder and changes the current working directory to it for isolated filesystem tests. 
 - 
isolation(input=None, env=None, color=False)¶
- A context manager that sets up the isolation for invoking of a command line tool. This sets up stdin with the given input data and - os.environwith the overrides from the given dictionary. This also rebinds some internals in Click to be mocked (like the prompt functionality).- This is automatically done in the - invoke()method.- New in version 4.0: The - colorparameter was added.- Parameters: - input – the input stream to put into sys.stdin.
- env – the environment overrides as dictionary.
- color – whether the output should contain color codes. The application can still override this explicitly.
 
 - 
make_env(overrides=None)¶
- Returns the environment overrides for invoking a script. 
 
-