Skip to content

Conversation

@sjanssen2
Copy link
Member

No description provided.

Comment on lines 30 to 34
# as we access functions directly, plugin configuration is not parsed,
# thus resort to environment variable here
self.qclient._plugincoupling = environ.get(
'QIITA_PLUGINCOUPLING', BaseQiitaPlugin._DEFAULT_PLUGIN_COUPLINGS)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should now be in PluginTestCase

Comment on lines 32 to 36
# as we access functions directly, plugin configuration is not parsed,
# thus resort to environment variable here
self.qclient._plugincoupling = environ.get(
'QIITA_PLUGINCOUPLING', BaseQiitaPlugin._DEFAULT_PLUGIN_COUPLINGS)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should now be in PluginTestCase

Comment on lines 85 to 89
# as we access functions directly, plugin configuration is not parsed,
# thus resort to environment variable here
self.qclient._plugincoupling = environ.get(
'QIITA_PLUGINCOUPLING', BaseQiitaPlugin._DEFAULT_PLUGIN_COUPLINGS)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should now be in PluginTestCase

Comment on lines 30 to 67
def _deposite_in_qiita_basedir(qclient, fps, update_fp_only=False):
"""Push a file to qiita main AND adapts given filepath accordingly.
A helper function to fix file paths in tests such that they point to the
expected BASE_DATA_DIR. This becomes necessary when uncoupling the plugin
filesystem as some methods now actually fetches expected files from
BASE_DATA_DIR.
Parameters
----------
qclient : qiita_client.QiitaClient
The Qiita server client
fps : str or [str]
Filepath or list of filepaths to file(s) that shall be part of
BASE_DATA_DIR, but currently points to some tmp file for testing.
update_fp_only : bool
Some tests operate on filepaths only - files do not actually need to
exist. Thus, we don't need to tranfer a file.
"""
if qclient._plugincoupling == 'filesystem':
return fps

# use artifact 1 info to determine BASA_DATA_DIR, as we know that the
# filepath ends with ....raw_data/1_s_G1_L001_sequences.fastq.gz, thus
# BASE_DATA_DIR must be the prefix, e.g. /qiita_data/
ainfo = qclient.get('/qiita_db/artifacts/1/')
base_data_dir = ainfo['files']['raw_forward_seqs'][0]['filepath'][
:(-1 * len('raw_data/1_s_G1_L001_sequences.fastq.gz'))]

if isinstance(fps, str):
if not update_fp_only:
qclient.push_file_to_central(fps)

return join(base_data_dir, relpath(fps, sep))
elif isinstance(fps, list):
for fp in fps:
if not update_fp_only:
qclient.push_file_to_central(fp)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better more the whole function to qiita_client/testing.py

from time import sleep

from qiita_client.testing import PluginTestCase
from qiita_client.plugin import BaseQiitaPlugin
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

necessary?

from qiita_client.plugin import BaseQiitaPlugin

from qtp_sequencing import plugin
from qtp_sequencing.tests.test_validate import _deposite_in_qiita_basedir
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

necessary?

files = {'raw_forward_seqs': [fp],
'raw_barcodes': [fp2]}
files = {'raw_forward_seqs': [
_deposite_in_qiita_basedir(self.qclient, fp)],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use super method

files = {'raw_forward_seqs': [
_deposite_in_qiita_basedir(self.qclient, fp)],
'raw_barcodes': [
_deposite_in_qiita_basedir(self.qclient, fp2)]}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use super method

"1.SKB3.640195": {"not_a_run_prefix": "prefix2"}}
files = {'preprocessed_fastq': [f1, f2, f3]}
files = {'preprocessed_fastq':
_deposite_in_qiita_basedir(self.qclient, [f1, f2, f3])}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use super method

(f2 + '.gz', 'preprocessed_fastq'),
(f3 + '.gz', 'preprocessed_fastq')]
filepaths = [
(_deposite_in_qiita_basedir(self.qclient, x + '.gz', True),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use super method

"1.SKB3.640195": {"not_a_run_prefix": "prefix2"}}
files = {'preprocessed_fastq': raw_files}
files = {'preprocessed_fastq':
_deposite_in_qiita_basedir(self.qclient, raw_files)}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use super method

self.assertTrue(obs_success)
filepaths = [('%s.gz' % x, 'preprocessed_fastq') for x in raw_files]
filepaths = [
(_deposite_in_qiita_basedir(self.qclient, '%s.gz' % x, True),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use super method

"1.SKB6.640176": {"run_prefix": "s4"}}
files = {'preprocessed_fastq': [fastq_fp]}
files = {'preprocessed_fastq':
[_deposite_in_qiita_basedir(self.qclient, fastq_fp)]}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use super method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants