Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
n8pease committed May 29, 2020
1 parent 123c015 commit bfb4125
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 21 deletions.
2 changes: 1 addition & 1 deletion python/lsst/daf/butler/cli/cmd/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"datasets. If this is not an absolute path, does not exist in the current working "
"directory, and --dir is provided, it is assumed to be in that directory. Defaults "
"to \"export.yaml\".",
type=click.Path('r'))
type=click.File('r'))
def butler_import(*args, **kwargs):
"""Import data into a butler repository."""
cli_handle_exception(butlerImport, *args, **kwargs)
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/cli/opt/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class directory_argument: # noqa: N801
Parameters
----------
required : bool, optional
required : `bool`, optional
Indicates if the caller must pass this argument to the command, by
default True.
help : str, optional
help : `str`, optional
The help text for this argument to append to the command's help text.
If None or '' then nothing will be appended to the help text (in which
case the command should document this argument directly in its help
Expand Down
15 changes: 5 additions & 10 deletions python/lsst/daf/butler/script/butlerImport.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,23 @@ def butlerImport(repo, directory, export_file, output_run, transfer):
Parameters
----------
repo : `str`
URI to the location of the repo.
URI to the location of the repo or URI to a config file describing the
repo and its location.
directory : `str`, or None
Directory containing dataset files. If `None`, all file paths must be
absolute.
export_file : `str`, optional
export_file : `TextIO`, or None
Name for the file that contains database information associated with
the exported datasets. If this is not an absolute path, does not exist
in the current working directory, and `directory` is not `None`, it is
assumed to be in `directory`. Defaults to "export.{format}".
output_run : `str`
output_run : `str`, or None
The path to the location, the run, where datasets should be put.
transfer : `str`
transfer : `str`, or None
The external data transfer type.
Returns
-------
butler : Butler
The butler intance, which can be used for test and verification.
"""
butler = Butler(repo, run=output_run, writeable=True)
butler.import_(directory=directory,
filename=export_file,
transfer=transfer,
format="yaml")
return butler
3 changes: 1 addition & 2 deletions tests/test_cliCmdImport.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ def test_almostAll(self):
case below.
"""
with self.runner.isolated_filesystem():
f = open("output.yaml", "w")
f.close()
expected = makeExpectedKwargs(repo="here", directory="foo", output_run="out", transfer="symlink")
self.run_test(["import", "here",
"foo",
Expand Down Expand Up @@ -109,6 +107,7 @@ def read_test(*args, **kwargs):
calling the Mocker, and thus before it gets here. A little bit is
written into the file here and that is verified later.
"""
print("in read_test")
ExportFileCase.didRead = kwargs["export_file"].read()

def test_exportFile(self):
Expand Down
6 changes: 0 additions & 6 deletions tests/test_cliPluginLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ def duplicate_command_test_env(runner):

class Suite(unittest.TestCase):

def setUp(self):
butler.cli.commands = None

def tearDown(self):
butler.cli.commands = None

def test_loadAndExecutePluginCommand(self):
"""Test that a plugin command can be loaded and executed."""
runner = click.testing.CliRunner()
Expand Down

0 comments on commit bfb4125

Please sign in to comment.