22 """Base class for writing CLI butler command tests.
25 __all__ = (
"ButlerCmdTestBase",)
31 from lsst.daf.butler.cli
import butler
35 """Base class for tests of butler command line interface subcommands.
36 Subclass from this, then `unittest.TestCase` to get a working test suite.
42 """Get the fully qualified instrument class.
47 The fully qualified instrument class.
54 """Get the instrument name.
59 The name of the instrument.
64 runner = click.testing.CliRunner()
65 with runner.isolated_filesystem():
66 result = runner.invoke(butler.cli, [
"create",
"here"])
67 self.assertEqual(result.exit_code, 0, f
"output: {result.output} exception: {result.exception}")
68 result = runner.invoke(butler.cli, [
"register-instrument",
70 "-i", self.instrumentClass()])
71 self.assertEqual(result.exit_code, 0, f
"output: {result.output} exception: {result.exception}")
72 result = runner.invoke(butler.cli, [
"write-curated-calibrations",
74 "-i", self.instrumentName(),
75 "--output-run",
"output_run"])
76 self.assertEqual(result.exit_code, 0, f
"output: {result.output} exception: {result.exception}")