-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mnshgl0110
committed
Oct 28, 2024
1 parent
6d39eb4
commit 9fb81bf
Showing
4 changed files
with
86,680 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
OX291574.1 22700724 12 60 61 |
Oops, something went wrong.