-
Notifications
You must be signed in to change notification settings - Fork 1
/
validate_biom.t
executable file
·41 lines (29 loc) · 1.07 KB
/
validate_biom.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from glob import glob
from subprocess import Popen, PIPE
from simpletap.motus import MotusTestCase
def biom_unavailable():
"Test if the biom command is available"
try:
p = Popen(["biom", "--version"], stdout=PIPE, stderr=PIPE)
out, err = p.communicate()
if p.returncode == 0:
return False
except Exception:
# Any failure and we return 'unavailable'
pass
return True
class TestBiomValidity(MotusTestCase):
@unittest.skipIf(biom_unavailable(), "biom command unavailable")
def test_biom_validity(self):
"biom validate-table on sample_data/*.biom"
for biom in glob("sample_data/*.biom"):
cmd = ("biom", "validate-table", "-i", biom)
stdout, stderr, exit = self.run_cmd(cmd)
self.assertRegexpMatches(stdout, "The input file is a valid BIOM-formatted file")
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner())
# vim: ai sts=4 et sw=4