Skip to content

Commit 5816ca5

Browse files
committed
Update test to not rely on \t in stout
Can cause issues with terminal settings, rich, typer etc. Add assertion for the expected sample names
1 parent 5693686 commit 5816ca5

1 file changed

Lines changed: 31 additions & 4 deletions

File tree

tests/e2e_integration/cli_commands/test_dimensions_cli.py

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,16 +477,43 @@ def test_show_dimensions_sample_names_stdout_streams_rows(
477477
project_id = project_map[project_name]
478478
user_id = 1
479479

480+
expected_sample_names = [
481+
"8_HOM-E57",
482+
"8_HOM-E59",
483+
"8_HOM-E64",
484+
"8_HOM-E74",
485+
"8_HOM-E78",
486+
"1a_HOM-G34",
487+
"5a_HOM-I13",
488+
"5a_HOM-I14",
489+
"5a_HOM-I20",
490+
"5a_HOM-I21",
491+
"5a_HOM-I7",
492+
"1b_HOM-G55",
493+
"1b_HOM-G58",
494+
"1b_HOM-G83",
495+
"5b_HOM-H17",
496+
"5b_HOM-H23",
497+
"5b_HOM-H25",
498+
"5b_HOM-H7",
499+
"7_HOM-J21",
500+
"4_HOM-P25",
501+
]
502+
480503
run_update_dimensions(bucket_name=bucket_name, project_id=project_id, project_name=project_name, user_id=user_id)
481504

482505
command = f"dimensions show --project {project_name} --sample-names-stdout"
483506
cli_result = runner.invoke(app, command)
484507
assert cli_result.exit_code == 0, f"Command failed with: {cli_result.stdout}"
485508

486-
lines = [line for line in cli_result.stdout.splitlines() if line.strip()]
487-
sample_rows = [line for line in lines if "\t" in line]
488-
assert len(sample_rows) > 0, "Expected streamed sample rows in stdout"
489-
assert all("\t" in line for line in sample_rows), "Expected tab-delimited rows in format: filename<TAB>sample_name"
509+
output_sample_names = [
510+
line.split()[1]
511+
for line in cli_result.stdout.splitlines()
512+
if len(line.split()) == 2 and line.split()[0].endswith((".vcf", ".vcf.gz"))
513+
]
514+
assert output_sample_names, "Expected streamed sample rows in stdout"
515+
missing = set(expected_sample_names) - set(output_sample_names)
516+
assert not missing, f"Missing sample names in output: {missing}"
490517

491518

492519
def test_show_dimensions_truncates_sample_names_in_terminal(

0 commit comments

Comments
 (0)