Skip to content

Commit

Permalink
Assert support for stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
wasade committed Oct 7, 2024
1 parent eca6840 commit 424a7fb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

test:
pytest micov

bash cli_test.sh
lint:
ruff check micov setup.py
check-manifest
8 changes: 8 additions & 0 deletions cli_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
xzcat micov/tests/test_data/test.sam.xz | micov compress > from_stdin
micov compress --data micov/tests/test_data/test.sam.xz > from_args
cmp --silent <(sort from_stdin) <(sort from_args)
if [[ $? -ne 0 ]]; then
echo "Files are different"
exit 1
fi
3 changes: 1 addition & 2 deletions micov/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os
import io
import sys
import tqdm
from glob import glob
from ._io import (parse_genome_lengths, parse_taxonomy, set_taxonomy_as_id,
parse_qiita_coverages, parse_sam_to_df, write_qiita_cov,
Expand Down Expand Up @@ -105,7 +104,7 @@ def compress(data, output, disable_compression, lengths, taxonomy):
if taxonomy is not None:
taxonomy = parse_taxonomy(taxonomy)

if os.path.isdir(data):
if data is not None and os.path.isdir(data):
file_list = (glob(data + "/*.sam")
+ glob(data + '/*.sam.xz')
+ glob(data + '/*.sam.gz'))
Expand Down
Binary file added micov/tests/test_data/test.sam.xz
Binary file not shown.

0 comments on commit 424a7fb

Please sign in to comment.