Skip to content

Commit 8ca71a9

Browse files
Merge pull request #4 from antgonza/update-qiita_db.artifacts
adding support for new /qiita_db/artifacts
2 parents 0bedf8f + 4a303b3 commit 8ca71a9

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

.github/workflows/qiita-plugin-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ jobs:
145145
- name: flake8
146146
uses: actions/setup-python@v2
147147
with:
148-
python-version: 3.6
148+
python-version: 3.9
149149
- name: install dependencies
150150
run: python -m pip install --upgrade pip
151151
- name: Check out repository code

qtp_job_output_folder/summary.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,15 @@ def generate_html_summary(qclient, job_id, parameters, out_dir):
6666
The error message, if not successful
6767
"""
6868
# Step 1: gather file information from qiita using REST api
69+
# we are going to use the "raw" code for retrieving artifact_info vs. the
70+
# qiita_client.artifact_and_preparation_files method because this only
71+
# expects a single filepath
6972
artifact_id = parameters['input_data']
7073
qclient_url = "/qiita_db/artifacts/%s/" % artifact_id
7174
artifact_info = qclient.get(qclient_url)
7275

7376
# [0] there is only one directory
74-
folder = artifact_info['files']['directory'][0]
77+
folder = artifact_info['files']['directory'][0]['filepath']
7578

7679
# 2. Generate summary
7780
index_fp, viz_fp = _generate_html_summary(job_id, folder, out_dir)

qtp_job_output_folder/tests/test_summary.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@ def test_summary(self):
6161
# asserting content of html
6262
res = self.qclient.get("/qiita_db/artifacts/%s/" % aid)
6363
# cleaning artifact files, to avoid errors
64-
[self._clean_up_files.extend(f) for f in res['files'].values()]
65-
html_fp = res['files']['html_summary'][0]
66-
self._clean_up_files.append(html_fp)
64+
[self._clean_up_files.extend([ff['filepath']])
65+
for f in res['files'].values() for ff in f]
66+
html_fp = res['files']['html_summary'][0]['filepath']
6767
with open(html_fp) as html_f:
6868
html = html_f.read()
6969

7070
self.assertCountEqual(
71-
html.split('\n'), EXP_HTML.format(aid=aid).split('\n'))
71+
sorted(html.replace('<br/>', '').split('\n')),
72+
sorted(EXP_HTML.format(aid=aid).replace('<br/>', '').split('\n')))
7273

7374

7475
EXP_HTML = (

0 commit comments

Comments
 (0)