Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.11.2
- fix: `python -m chipstream.cli` failed with ModuleNotFoundError
- fix: `chipstream-cli --recursive` silently did nothing when PATH_IN is a file
0.11.1
- enh: don't show rounded 100% in CLI progress
- setup: bump dcnum to 0.31.2
Expand Down
7 changes: 6 additions & 1 deletion chipstream/cli/cli_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,12 @@ def chipstream_cli(
debug=debug,
)

if recursive:
if recursive and not path_in.is_dir():
click.secho(f"PATH_IN must be a directory in recursive mode, but "
f"'{path_in}' is a file. Omit the `--recursive` flag "
f"to process a single file.", fg="red")
exit_code = 1
elif recursive:
failed = 0 # keeps track of files that failed to process
for pi in sorted(path_in.rglob("*.rtdc")):
if pi.name.endswith("_dcn.rtdc"):
Expand Down
11 changes: 11 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@ def test_cli_python_m():
assert chipstream.__version__ in result.stdout


def test_cli_recursive_with_file(cli_runner):
"""Recursive mode requires a directory as input"""
path = retrieve_data(
"fmt-hdf5_cytoshot_full-features_legacy_allev_2023.zip")
result = cli_runner.invoke(cli_main.chipstream_cli,
[str(path), "--recursive"])
assert result.exit_code == 1
assert result.stdout.count("must be a directory in recursive mode")
assert not path.with_name(path.stem + "_dcn.rtdc").exists()


def test_cli_set_pixel_size(cli_runner):
path_temp = retrieve_data(
"fmt-hdf5_cytoshot_full-features_legacy_allev_2023.zip")
Expand Down
Loading