Skip to content

Commit

Permalink
Fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Feb 11, 2025
1 parent 7a005bf commit ec3ca7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion cubids/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,17 @@ def test_validate_command(tmp_path):
bids_dir.mkdir()
(bids_dir / "dataset_description.json").touch()

# Create output prefix
output_prefix = tmp_path / "validation_output"

# Test validation
with pytest.raises(SystemExit) as excinfo:
_main(["validate", str(bids_dir)])
_main(["validate", str(bids_dir), str(output_prefix)])
assert excinfo.value.code == 0

# Check that output files were created
assert (output_prefix.parent / f"{output_prefix.name}_validation.txt").exists()


def test_validate_command_invalid_dir(tmp_path):
"""Test the validate command with an invalid directory."""
Expand Down
4 changes: 2 additions & 2 deletions cubids/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def validate(
parsed = parse_validator_output(ret.stdout.decode("UTF-8"))
if parsed.shape[1] < 1:
logger.info("No issues/warnings parsed, your dataset is BIDS valid.")
sys.exit(0)
return
else:
logger.info("BIDS issues/warnings found in the dataset")

Expand All @@ -110,7 +110,7 @@ def validate(
json.dump(val_dict, outfile, indent=4)

logger.info("Writing issues out to %s", val_tsv)
sys.exit(0)
return
else:
# user may be in python session, return dataframe
return parsed
Expand Down

0 comments on commit ec3ca7e

Please sign in to comment.