Skip to content

Commit

Permalink
adding test data
Browse files Browse the repository at this point in the history
  • Loading branch information
mnshgl0110 committed Oct 28, 2024
1 parent 6d39eb4 commit 9fb81bf
Show file tree
Hide file tree
Showing 4 changed files with 86,680 additions and 0 deletions.
66 changes: 66 additions & 0 deletions test/pytest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/env python3
import unittest
import os


class TestHometools(unittest.TestCase):
def test_cli(self):
from subprocess import Popen, PIPE
p = Popen('plotsr -h'.split(), stdout=PIPE, stderr=PIPE)
out = p.communicate()
assert 'error' not in out[1].decode()

def test_pdf_out(self):
from subprocess import Popen, PIPE
import os
from glob import glob
output = 'plotsr.pdf'

try:
os.remove(output)
except OSError as e:
pass

command = f'plotsr --sr syri.out --genomes genomes.txt -o {output}'.split()
p = Popen(command, stdout=PIPE, stderr=PIPE)
out = p.communicate()

assert os.path.isfile(output)
os.remove(output)
for f in glob(f"*log"):
try:
os.remove(f)
except OSError as e:
if e.errno != 2: # 2 is the error number when no such file or directory is present https://docs.python.org/2/library/errno.html
raise

def test_png_out(self):
from subprocess import Popen, PIPE
import os
from glob import glob
output = 'plotsr.png'

try:
os.remove(output)
except OSError as e:
pass

command = f'plotsr --sr syri.out --genomes genomes.txt -o {output}'.split()
p = Popen(command, stdout=PIPE, stderr=PIPE)
out = p.communicate()

assert os.path.isfile(output)
os.remove(output)
for f in glob(f"*log"):
try:
os.remove(f)
except OSError as e:
if e.errno != 2: # 2 is the error number when no such file or directory is present https://docs.python.org/2/library/errno.html
raise


if __name__ == '__main__':
os.chdir('test/test_data/')
unittest.main(verbosity=3)


1 change: 1 addition & 0 deletions test/test_data/ler_chr4.fa.gz.fai
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
OX291574.1 22700724 12 60 61
Loading

0 comments on commit 9fb81bf

Please sign in to comment.