Skip to content

Commit eed36ed

Browse files
authored
Merge pull request #3 from jlab/fetch_directories_clean
prepare to clean up filepath mess
2 parents d226ab5 + fa819be commit eed36ed

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

.github/workflows/qiita-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ jobs:
5454
# all config files
5555
# wget https://github.com/biocore/qiita/archive/dev.zip
5656
# unzip dev.zip
57-
wget https://github.com/jlab/qiita/archive/refs/heads/tornado_FetchFileFromCentralHandler.zip
58-
unzip tornado_FetchFileFromCentralHandler.zip
59-
mv qiita-tornado_FetchFileFromCentralHandler qiita-dev
57+
wget https://github.com/jlab/qiita/archive/refs/heads/tornado_FetchFileFromCentralHandler_alsoDirs_debug.zip
58+
unzip tornado_FetchFileFromCentralHandler_alsoDirs_debug.zip
59+
mv qiita-tornado_FetchFileFromCentralHandler_alsoDirs_debug qiita-dev
6060
6161
# pull out the port so we can modify the configuration file easily
6262
pgport=${{ job.services.postgres.ports[5432] }}

qiita_client/tests/test_qiita_client.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from json import dumps
1515
import pandas as pd
1616
from shutil import rmtree
17-
from pathlib import Path
1817

1918
from qiita_client.qiita_client import (QiitaClient, _format_payload,
2019
ArtifactInfo)
@@ -528,29 +527,29 @@ def test_delete_file_from_central(self):
528527
self.assertTrue(exists(fp_deleted))
529528

530529
def test_fetch_directory(self):
531-
# creating a test directory
532-
fp_test = join('./job', '2_test_folder', 'source')
533-
self._create_test_dir(prefix=fp_test)
534-
535-
# transmitting test directory into qiita main
536-
self.tester._plugincoupling = 'https'
537-
self.tester.push_file_to_central(fp_test)
538530
# a bit hacky, but should work as long as test database does not change
539531
ainfo = self.qclient.get('/qiita_db/artifacts/1/')
540532
base_data_dir = ainfo['files']['raw_forward_seqs'][0]['filepath'][
541533
:(-1 * len('raw_data/1_s_G1_L001_sequences.fastq.gz'))]
542-
fp_main = join(base_data_dir, join(*Path(fp_test).parts))
543534

544-
# fetch test directory from qiita main, this time storing it at
545-
# QIITA_BASE_DIR
535+
# creating a LOCAL test directory within base_data_dir as the DB entry
536+
# but no files exist. "job" is the according mountpoint
537+
fp_test = join(base_data_dir, 'job', '2_test_folder')
538+
self._create_test_dir(prefix=fp_test)
539+
540+
# transmitting test directory to qiita main (remote)
541+
self.tester._plugincoupling = 'https'
542+
self.tester.push_file_to_central(fp_test)
543+
# fp_main = join(base_data_dir, join(*Path(fp_test).parts))
544+
545+
# fetch test directory from qiita main to a different location
546+
# (=prefix) than it was generated
546547
prefix = join(expanduser("~"), 'localFetch')
547-
fp_obs = self.tester.fetch_file_from_central(
548-
dirname(fp_main), prefix=prefix)
548+
fp_obs = self.tester.fetch_file_from_central(fp_test, prefix=prefix)
549549

550550
# test a file of the freshly transferred directory from main has
551551
# expected file content
552-
with open(join(fp_obs, 'job/2_test_folder/job/2_test_folder/',
553-
'source', 'testdir', 'fileA.txt'), 'r') as f:
552+
with open(join(fp_obs, 'testdir', 'fileA.txt'), 'r') as f:
554553
self.assertIn('contentA', '\n'.join(f.readlines()))
555554

556555

0 commit comments

Comments
 (0)