Skip to content

Commit

Permalink
use LogCliRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
n8pease committed Jul 14, 2020
1 parent 566bc58 commit 620659a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions python/lsst/obs/base/cli/butler_cmd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@
__all__ = ("ButlerCmdTestBase",)

import abc
import click
import click.testing

from lsst.daf.butler.cli import butler
from lsst.daf.butler.cli.utils import LogCliRunner
from lsst.utils import doImport


Expand Down Expand Up @@ -77,7 +76,7 @@ def instrumentName(self):
return self.instrument.getName()

def test_cli(self):
runner = click.testing.CliRunner()
runner = LogCliRunner()
with runner.isolated_filesystem():
result = runner.invoke(butler.cli, ["create", "here"])
self.assertEqual(result.exit_code, 0, f"output: {result.output} exception: {result.exception}")
Expand Down
10 changes: 5 additions & 5 deletions python/lsst/obs/base/ingest_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
__all__ = ("IngestTestBase",)

import abc
import click.testing
import tempfile
import unittest
import os
import shutil

from lsst.daf.butler import Butler
from lsst.daf.butler.cli.butler import cli as butlerCli
from lsst.daf.butler.cli.utils import LogCliRunner
import lsst.obs.base
from lsst.utils import doImport
from .utils import getInstrument
Expand Down Expand Up @@ -164,7 +164,7 @@ def checkRepo(self, files=None):
def _createRepo(self):
"""Use the Click `testing` module to call the butler command line api
to create a repository."""
runner = click.testing.CliRunner()
runner = LogCliRunner()
result = runner.invoke(butlerCli, ["create", self.root])
self.assertEqual(result.exit_code, 0, f"output: {result.output} exception: {result.exception}")

Expand All @@ -177,7 +177,7 @@ def _ingestRaws(self, transfer):
transfer : `str`
The external data transfer type.
"""
runner = click.testing.CliRunner()
runner = LogCliRunner()
result = runner.invoke(butlerCli, ["ingest-raws", self.root,
"--output-run", self.outputRun,
"--file", self.file,
Expand All @@ -188,14 +188,14 @@ def _ingestRaws(self, transfer):
def _registerInstrument(self):
"""Use the Click `testing` module to call the butler command line api
to register the instrument."""
runner = click.testing.CliRunner()
runner = LogCliRunner()
result = runner.invoke(butlerCli, ["register-instrument", self.root, self.instrumentClassName])
self.assertEqual(result.exit_code, 0, f"output: {result.output} exception: {result.exception}")

def _writeCuratedCalibrations(self):
"""Use the Click `testing` module to call the butler command line api
to write curated calibrations."""
runner = click.testing.CliRunner()
runner = LogCliRunner()
result = runner.invoke(butlerCli, ["write-curated-calibrations", self.root,
"--instrument", self.instrumentName,
"--output-run", self.outputRun])
Expand Down

0 comments on commit 620659a

Please sign in to comment.