-
Notifications
You must be signed in to change notification settings - Fork 0
Uncouple plugin #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
qtp_sequencing/tests/test_plugin.py
Outdated
| # 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) | ||
|
|
There was a problem hiding this comment.
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
qtp_sequencing/tests/test_summary.py
Outdated
| # 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) | ||
|
|
There was a problem hiding this comment.
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
| # 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) | ||
|
|
There was a problem hiding this comment.
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
| 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) |
There was a problem hiding this comment.
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
qtp_sequencing/tests/test_plugin.py
Outdated
| from time import sleep | ||
|
|
||
| from qiita_client.testing import PluginTestCase | ||
| from qiita_client.plugin import BaseQiitaPlugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
necessary?
qtp_sequencing/tests/test_plugin.py
Outdated
| from qiita_client.plugin import BaseQiitaPlugin | ||
|
|
||
| from qtp_sequencing import plugin | ||
| from qtp_sequencing.tests.test_validate import _deposite_in_qiita_basedir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
necessary?
qtp_sequencing/tests/test_plugin.py
Outdated
| files = {'raw_forward_seqs': [fp], | ||
| 'raw_barcodes': [fp2]} | ||
| files = {'raw_forward_seqs': [ | ||
| _deposite_in_qiita_basedir(self.qclient, fp)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use super method
qtp_sequencing/tests/test_plugin.py
Outdated
| files = {'raw_forward_seqs': [ | ||
| _deposite_in_qiita_basedir(self.qclient, fp)], | ||
| 'raw_barcodes': [ | ||
| _deposite_in_qiita_basedir(self.qclient, fp2)]} |
There was a problem hiding this comment.
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])} |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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)} |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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)]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use super method
No description provided.