diff --git a/cubids/tests/test_bond.py b/cubids/tests/test_bond.py index 28211cc2d..2f181f12f 100644 --- a/cubids/tests/test_bond.py +++ b/cubids/tests/test_bond.py @@ -983,11 +983,27 @@ def test_datalad_integration(tmp_path): def test_validator(tmp_path): """Test validator.""" data_root = get_data(tmp_path) - + + # Ensure the dataset directory exists + dataset_dir = os.path.join(data_root, "complete") + # Debugging: Print the dataset_dir + print("Dataset dir:", dataset_dir) + print(os.listdir(dataset_dir)) + if not os.path.exists(dataset_dir): + raise FileNotFoundError(f"Dataset directory does not exist: {dataset_dir}") + # test the validator in valid dataset - call = build_validator_call(str(data_root) + "/complete") + call = build_validator_call(dataset_dir) + + # Debugging: Print the constructed command + print("Validator command:", call) + ret = run_validator(call) + # Print the output for debugging + print("Validator output:", ret.stdout.decode("UTF-8")) + print("Validator error:", ret.stderr.decode("UTF-8")) + assert ret.returncode == 0 parsed = parse_validator_output(ret.stdout.decode("UTF-8")) diff --git a/cubids/validator.py b/cubids/validator.py index 01dad11c8..1f6bdb7be 100644 --- a/cubids/validator.py +++ b/cubids/validator.py @@ -16,12 +16,18 @@ def build_validator_call(path, ignore_headers=False): """Build a subprocess command to the bids validator.""" # build docker call # CuBIDS automatically ignores subject consistency. - command = ["bids-validator", "--verbose", "--json", "--ignoreSubjectConsistency"] + + command = ["bids-validator", path, "--verbose", "--json", "--ignoreSubjectConsistency"] if ignore_headers: command.append("--ignoreNiftiHeaders") - command.append(path) + # command = ["bids-validator", "--verbose", "--json", "--ignoreSubjectConsistency"] + + # if ignore_headers: + # command.append("--ignoreNiftiHeaders") + + # command.append(path) return command