Skip to content

Commit 3842dc6

Browse files
committed
adding _inject_data
1 parent dc5b1d0 commit 3842dc6

File tree

1 file changed

+40
-24
lines changed

1 file changed

+40
-24
lines changed

tests/test_WorkflowFactory.py

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -106,30 +106,10 @@ def test_invalid_sample_sheets(self):
106106
with self.assertRaisesRegex(ValueError, msg):
107107
WorkflowFactory.generate_workflow(**kwargs)
108108

109-
def test_metagenomic_workflow_creation(self):
110-
kwargs = {"uif_path": "tests/data/sample-sheets/metagenomic/"
111-
"illumina/good_sheet1.csv",
112-
"qclient": self.qclient,
113-
"lane_number": "1",
114-
"config_fp": "tests/configuration.json",
115-
"run_identifier": "211021_A00000_0000_SAMPLE",
116-
"output_dir": self.output_dir,
117-
"job_id": "78901",
118-
"is_restart": False
119-
}
120-
121-
self._create_directory(kwargs['output_dir'])
122-
123-
wf = WorkflowFactory.generate_workflow(**kwargs)
124-
125-
# confirm that the proper type of workflow was generated.
126-
self.assertEqual(wf.protocol_type, PROTOCOL_NAME_ILLUMINA)
127-
self.assertEqual(wf.assay_type, ASSAY_NAME_METAGENOMIC)
128-
129-
with self.assertRaisesRegex(
130-
PipelineError, 'There are no fastq files for FastQCJob'):
131-
wf.execute_pipeline()
132-
109+
def _inject_data(self, wf):
110+
'''This is a helper method for testing that all the steps are run
111+
when testing wf.execute_pipeline()
112+
'''
133113
# inject Convert/NuQC/FastQC/MultiQC/GenPrepFileJob files so we can
134114
# move down the pipeline; first let's create the base folders
135115
gz_source = f'{self.base_dir}/data/dummy.fastq.gz'
@@ -189,6 +169,32 @@ def test_metagenomic_workflow_creation(self):
189169
Path(f'{fastqc_dir}/FastQCJob_{i}.completed').touch()
190170
Path(f'{multiqc_dir}/MultiQCJob_{i}.completed').touch()
191171

172+
173+
def test_metagenomic_workflow_creation(self):
174+
kwargs = {"uif_path": "tests/data/sample-sheets/metagenomic/"
175+
"illumina/good_sheet1.csv",
176+
"qclient": self.qclient,
177+
"lane_number": "1",
178+
"config_fp": "tests/configuration.json",
179+
"run_identifier": "211021_A00000_0000_SAMPLE",
180+
"output_dir": self.output_dir,
181+
"job_id": "78901",
182+
"is_restart": False
183+
}
184+
185+
self._create_directory(kwargs['output_dir'])
186+
187+
wf = WorkflowFactory.generate_workflow(**kwargs)
188+
189+
# confirm that the proper type of workflow was generated.
190+
self.assertEqual(wf.protocol_type, PROTOCOL_NAME_ILLUMINA)
191+
self.assertEqual(wf.assay_type, ASSAY_NAME_METAGENOMIC)
192+
193+
with self.assertRaisesRegex(
194+
PipelineError, 'There are no fastq files for FastQCJob'):
195+
wf.execute_pipeline()
196+
197+
self._inject_data(wf)
192198
wf.execute_pipeline()
193199

194200
def test_metatranscriptomic_workflow_creation(self):
@@ -215,6 +221,9 @@ def test_metatranscriptomic_workflow_creation(self):
215221
PipelineError, 'There are no fastq files for FastQCJob'):
216222
wf.execute_pipeline()
217223

224+
self._inject_data(wf)
225+
wf.execute_pipeline()
226+
218227
def test_amplicon_workflow_creation(self):
219228
kwargs = {"uif_path": "tests/data/pre-preps/good_pre_prep1.txt",
220229
"qclient": self.qclient,
@@ -237,6 +246,9 @@ def test_amplicon_workflow_creation(self):
237246
NotFoundError, '{"message": "Study not found"}'):
238247
wf.execute_pipeline()
239248

249+
self._inject_data(wf)
250+
wf.execute_pipeline()
251+
240252
def test_tellseq_workflow_creation(self):
241253
kwargs = {"uif_path": "tests/data/sample-sheets/metagenomic/"
242254
"tellseq/good_sheet1.csv",
@@ -262,6 +274,10 @@ def test_tellseq_workflow_creation(self):
262274
'TellReadJob/sample_index_list_TellReadJob.txt'):
263275
wf.execute_pipeline()
264276

277+
self._inject_data(wf)
278+
wf.execute_pipeline()
279+
280+
265281

266282
if __name__ == '__main__':
267283
main()

0 commit comments

Comments
 (0)