Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
mnshgl0110 committed Oct 28, 2024
1 parent 751c419 commit 422abd5
Showing 1 changed file with 15 additions and 26 deletions.
41 changes: 15 additions & 26 deletions test/pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,7 @@ def test_cli(self):
p = Popen('syri -h'.split(), stdout=PIPE, stderr=PIPE)
out = p.communicate()
assert 'error' not in out[1].decode()

# def test_coords_input(self):
# from subprocess import Popen, PIPE
# from glob import glob
# coords = "out.filtered.coords"
# delta = "out.filtered.delta"
# ref = "tair10_chr4.fa.gz"
# qry = "ler_chr4.fa.gz"
# cdir = os.getcwd()
# os.chdir('test/test_data/')
# command = f'syri -c {coords} -d {delta} -r {ref} -q {qry} -k -F T --prefix test_coords'.split()
# p = Popen(command, stdout=PIPE, stderr=PIPE)
# out = p.communicate()
# print(out)
# assert all([f in glob("test_coords*") for f in ["test_coordssyri.out", "test_coordssyri.vcf", "test_coordssyri.summary"]])
#
# # END
# END

def test_bam_input(self):
from subprocess import Popen, PIPE
Expand All @@ -33,14 +17,17 @@ def test_bam_input(self):
bam = 'out.bam'
ref = "tair10_chr4.fa.gz"
qry = "ler_chr4.fa.gz"
# cdir = os.getcwd()
# os.chdir('test/test_data/')
command = f'syri -c {bam} -r {ref} -q {qry} -F B --prefix test_bam'.split()
prefix = "test_bam"
for f in glob(f"{prefix}*"):
try:
os.remove(f)
except OSError as e:
pass
command = f'syri -c {bam} -r {ref} -q {qry} -F B --prefix {prefix}'.split()
p = Popen(command, stdout=PIPE, stderr=PIPE)
out = p.communicate()
print(out)
assert all([f in glob("test_bam*") for f in ["test_bamsyri.out", "test_bamsyri.vcf", "test_bamsyri.summary"]])
for f in glob("test_bam*"):
assert all([f"{prefix}{f}" in glob(f"{prefix}*") for f in ["syri.out", "syri.vcf", "syri.summary"]])
for f in glob(f"{prefix}*"):
try:
os.remove(f)
except OSError as e:
Expand All @@ -55,12 +42,14 @@ def test_paf_input(self):
ref = "tair10_chr4.fa.gz"
qry = "ler_chr4.fa.gz"
prefix = "test_paf"
# cdir = os.getcwd()
# os.chdir('test/test_data/')
for f in glob(f"{prefix}*"):
try:
os.remove(f)
except OSError:
pass
command = f'syri -c {paf} -r {ref} -q {qry} -F P --prefix {prefix}'.split()
p = Popen(command, stdout=PIPE, stderr=PIPE)
out = p.communicate()
print(out)
assert all([f"{prefix}{f}" in glob(f"{prefix}*") for f in ["syri.out", "syri.vcf", "syri.summary"]])
for f in glob(f"{prefix}*"):
try:
Expand Down

0 comments on commit 422abd5

Please sign in to comment.