Skip to content

Commit f559d32

Browse files
author
Will Trimble
committed
updates to tests
1 parent 88888cc commit f559d32

1 file changed

Lines changed: 37 additions & 6 deletions

File tree

tests/test_mgrtools.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def runme(command, workingdir=".", fail_ok=False):
2121
os.chdir(workingdir)
2222

2323
try:
24-
p=subprocess.Popen(command.split(" "), stdout=PIPE, stderr=PIPE)
24+
p=subprocess.Popen(command, stdout=PIPE, stderr=PIPE, shell=True)
2525
except SystemExit as err:
2626
p = err.code
2727
out, err = p.communicate()
@@ -101,9 +101,9 @@ def test_binscripts_help():
101101
assert b'DESCRIPTION' in out
102102

103103
def test_jsonviewer():
104-
s = '''echo '{"a": {"b": {"c": [1, 2, 3, 4, 5]}}, "x": ["y", "z"], "foo": "bar"}' | jsonviewer'''
104+
s = '''echo '{"a": {"b": {"c": [1, 2, 3, 4, 5]}}, "x": ["y", "z"], "foo": "bar"}' | jsonviewer.py'''
105105
stat, out, err = runme(s)
106-
s2 = '''echo '{"a": {"b": {"c": [1, 2, 3, 4, 5]}}, "x": ["y", "z"], "foo": "bar"}' | jsonviewer --value 'a.b.c' --json'''
106+
s2 = '''echo '{"a": {"b": {"c": [1, 2, 3, 4, 5]}}, "x": ["y", "z"], "foo": "bar"}' | jsonviewer.py --value 'a.b.c' --json'''
107107
stat, out, err = runme(s2)
108108

109109
def test_mg_abundant_functions():
@@ -116,7 +116,7 @@ def test_mg_abundant_taxa():
116116

117117
@pytest.mark.huge
118118
def test_mg_compare_taxa():
119-
s = '''mg-compare-taxa.py --ids mgm4441679.3,mgm4441680.3,mgm4441681.3,mgm4441682.3 --level class --source RefSeq --format text | mg-changing-annotation --input - --format text --groups {"group1":["mgm4441679.3","mgm4441680.3"],"group2":["mgm4441681.3","mgm4441682.3"]} --top 5 --stat_test Kruskal-Wallis'''
119+
s = '''mg-compare-taxa.py --ids mgm4441679.3,mgm4441680.3,mgm4441681.3,mgm4441682.3 --level class --source RefSeq --format text | mg-changing-annotation.py --input - --format text --groups '{"group1":["mgm4441679.3","mgm4441680.3"],"group2":["mgm4441681.3","mgm4441682.3"]}' --top 5 --stat_test Kruskal-Wallis'''
120120
stat, out, err = runme(s)
121121

122122
@pytest.mark.huge
@@ -155,7 +155,7 @@ def test_mg_get_annotation_set():
155155
assert stat == 0
156156

157157
def test_mg_get_sequences_for_function():
158-
s='''mg-get-sequences-for-function.py --id mgm4441680.3 --name Central\ carbohydrate\ metabolism --level level2 --source Subsystems --evalue 10'''
158+
s='''mg-get-sequences-for-function.py --id mgm4441680.3 --name "Central carbohydrate metabolism" --level level2 --source Subsystems --evalue 10'''
159159
stat, out, err = runme(s)
160160
assert stat == 0
161161

@@ -164,6 +164,18 @@ def test_mg_get_sequences_for_taxon():
164164
stat, out, err = runme(s)
165165
assert stat == 0
166166

167+
def test_mg_query_matrix():
168+
s='''mg-query.py 'http://api.mg-rast.org/matrix/function?id=mgm4447943.3' '''
169+
stat, out, err = runme(s)
170+
assert stat == 0
171+
assert b'acter' in out
172+
173+
@pytest.mark.known_failing
174+
def test_mg_query_darkmatter():
175+
s='''mg-query.py 'http://api.mg-rast.org/darkmatter/mgm4447943.3' '''
176+
stat, out, err = runme(s)
177+
assert stat == 0
178+
167179
def test_mg_get_similarity_for_taxon():
168180
s='''mg-get-similarity-for-function.py --id mgm4441680.3 --name Central\ carbohydrate\ metabolism --level level2 --source Subsystems --evalue 10'''
169181
stat, out, err = runme(s)
@@ -182,16 +194,35 @@ def test_mg_retrieve_uniprot():
182194
s='''mg-retrieve-uniprot.py --md5 ffc62262a18b38671c3e337150ef535f --source SwissProt'''
183195
stat, out, err = runme(s)
184196
assert stat == 0
185-
def test_mg_search_metagenomes():
197+
198+
def test_mg_project():
199+
s='''mg-project.py get-info mgp128'''
200+
stat, out, err = runme(s)
201+
assert stat == 0
202+
203+
def test_mg_search_metagenomes__help():
186204
s='''mg-search-metagenomes.py --help'''
187205
stat, out, err = runme(s)
188206
assert stat == 0
207+
208+
def test_mg_display_metadata():
209+
s='''mg-display-metadata.py --id "mgm4441680.3" --verbosity full'''
210+
stat, out, err = runme(s)
211+
assert stat == 0
212+
assert b"medium-quality grass-legume hay" in out
213+
189214
@pytest.mark.requires_auth
190215
def test_mg_submit():
191216
s='''mg-submit.py list'''
192217
stat, out, err = runme(s)
193218
assert stat == 0
194219

220+
def test_mg_m5nrtoolspl():
221+
s='''m5nr-tools.pl --api http://api.mg-rast.org/ --option annotation --source RefSeq --md5 0b95101ffea9396db4126e4656460ce5,068792e95e38032059ba7d9c26c1be78,0b96c9'''
222+
stat, out, err = runme(s)
223+
assert stat == 0
224+
assert b"alcohol dehydrogenase" in out
225+
195226
@pytest.mark.known_failing
196227
def test_known_failing():
197228
assert False # This should not normally run

0 commit comments

Comments
 (0)