Skip to content

Commit

Permalink
fix argument order and adds @sbesson test
Browse files Browse the repository at this point in the history
  • Loading branch information
glyg committed Aug 13, 2020
1 parent 399f32e commit 1e7be00
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/omero/util/import_candidates.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def as_stdout(path, readers="", extra_args=None):
cli = CLI()
cli.loadplugins()
if readers:
cli.invoke(["import", "-l"] + extra_args + [readers, "-f"] + path)
cli.invoke(["import", "-l"] + [readers,] + extra_args + ["-f"] + path)
else:
cli.invoke(["import"] + extra_args + ["-f"] + path)
if cli.rv != 0:
Expand Down
23 changes: 23 additions & 0 deletions test/unit/clitest/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,3 +541,26 @@ def testImportCandidatesDepth(self, tmpdir):
)
assert str(fakefile) in candidates
assert str(fakefile2) not in candidates

@pytest.mark.skipif(sys.platform == "win32", reason="Fails on Windows")
def testImportCandidatesReaders(self, tmpdir):
"""
Test using import_candidates with a populated readers.txt
"""
fakefile = tmpdir.join("test.fake")
fakefile.write('')
patternfile = tmpdir.join("test.pattern")
patternfile.write('test.fake')
readers = tmpdir.join("readers.txt")
readers.write('loci.formats.in.FakeReader')
candidates = import_candidates.as_dictionary(str(tmpdir))
assert str(patternfile) in candidates
assert str(fakefile) in candidates[str(patternfile)]
candidates = import_candidates.as_dictionary(
str(tmpdir), readers=str(readers))
assert str(fakefile) in candidates
assert str(patternfile) not in candidates
candidates = import_candidates.as_dictionary(
str(tmpdir), readers=str(readers), extra_args=["--debug", "WARN"])
assert str(fakefile) in candidates
assert str(patternfile) not in candidates

0 comments on commit 1e7be00

Please sign in to comment.