From a32879db77fb70c1d06170c508d813e59bd9ed4d Mon Sep 17 00:00:00 2001
From: "Gervaise H. Henry" <gervaise.henry@utsouthwestern.edu>
Date: Wed, 27 Jan 2021 10:11:51 -0600
Subject: [PATCH] Update pytests

---
 .gitlab-ci.yml                           | 14 ++++----
 workflow/tests/test_alignReads.py        | 14 ++++----
 workflow/tests/test_completion.py        | 42 ++----------------------
 workflow/tests/test_dedupReads.py        | 18 +++++-----
 workflow/tests/test_makeBigWig.py        |  4 +--
 workflow/tests/test_makeFeatureCounts.py |  8 ++---
 6 files changed, 32 insertions(+), 68 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 031ebfa..3dcc027 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -666,7 +666,7 @@ integration_se:
   - ulimit -a
   - nextflow -q run ./workflow/rna-seq.nf --deriva ./test_data/auth/credential.json --bdbag ./test_data/auth/cookies.txt --repRID 16-1ZX4 --source staging --upload true -with-dag dag.png --dev false --ci true -with-report ./SE_report.html
   - find . -type f -name "multiqc_data.json" -exec cp {} ./SE_multiqc_data.json \;
-  - pytest -m completionIntegration_se
+  - pytest -m completion("SE_multiqc_data.json")
   artifacts:
     name: "$CI_JOB_NAME"
     when: always
@@ -691,7 +691,7 @@ integration_pe:
   - ulimit -a
   - nextflow -q run ./workflow/rna-seq.nf --deriva ./test_data/auth/credential.json --bdbag ./test_data/auth/cookies.txt --repRID Q-Y5JA --source staging --upload true -with-dag dag.png --dev false --ci true -with-report ./PE_report.html
   - find . -type f -name "multiqc_data.json" -exec cp {} ./PE_multiqc_data.json \;
-  - pytest -m completionIntegration_pe
+  - pytest -m completion("PE_multiqc_data.json")
   artifacts:
     name: "$CI_JOB_NAME"
     when: always
@@ -793,7 +793,7 @@ override_inputBag:
   - ulimit -a
   - nextflow -q run ./workflow/rna-seq.nf --deriva ./test_data/auth/credential.json --bdbag ./test_data/auth/cookies.txt --repRID Q-Y5F6 --source staging --inputBagForce ./test_data/bag/Q-Y5F6_inputBag_xxxxxxxx.zip --upload false --dev false --ci true -with-report ./inputBagOverride_report.html
   - find . -type f -name "multiqc_data.json" -exec cp {} ./inputBagOverride_PE_multiqc_data.json \;
-  - pytest -m completionOverride_inputBag
+  - pytest -m completion("inputBagOverride_PE_multiqc_data.json")
   artifacts:
     name: "$CI_JOB_NAME"
     when: always
@@ -816,7 +816,7 @@ override_fastq:
   - ulimit -a
   - nextflow -q run ./workflow/rna-seq.nf --deriva ./test_data/auth/credential.json --bdbag ./test_data/auth/cookies.txt --repRID Q-Y5F6  --source staging --fastqsForce './test_data/fastq/small/Q-Y5F6_1M.R{1,2}.fastq.gz' --upload false --dev false --ci true -with-report ./fastqOverride_report.html
   - find . -type f -name "multiqc_data.json" -exec cp {} ./fastqOverride_PE_multiqc_data.json \;
-  - pytest -m completionOverride_fastq
+  - pytest -m completion("fastqOverride_PE_multiqc_data.json")
   artifacts:
     name: "$CI_JOB_NAME"
     when: always
@@ -839,7 +839,7 @@ override_species:
   - ulimit -a
   - nextflow -q run ./workflow/rna-seq.nf --deriva ./test_data/auth/credential.json --bdbag ./test_data/auth/cookies.txt --repRID Q-Y5ER --source staging --speciesForce 'Homo sapiens' --upload false --dev false --ci true -with-report ./speciesOverride_report.html
   - find . -type f -name "multiqc_data.json" -exec cp {} ./speciesOverride_PE_multiqc_data.json \;
-  - pytest -m completionOverride_spike
+  - pytest -m completion("speciesOverride_PE_multiqc_data.json")
   artifacts:
     name: "$CI_JOB_NAME"
     when: always
@@ -862,7 +862,7 @@ override_stranded:
   - ulimit -a
   - nextflow -q run ./workflow/rna-seq.nf --deriva ./test_data/auth/credential.json --bdbag ./test_data/auth/cookies.txt --repRID Q-Y5ER --source staging --strandedForce unstranded --upload false --dev false --ci true -with-report ./strandedOverride_report.html
   - find . -type f -name "multiqc_data.json" -exec cp {} ./strandedOverride_PE_multiqc_data.json \;
-  - pytest -m completionOverride_stranded
+  - pytest -m completion("strandedOverride_PE_multiqc_data.json")
   artifacts:
     name: "$CI_JOB_NAME"
     when: always
@@ -885,7 +885,7 @@ override_spike:
   - ulimit -a
   - nextflow -q run ./workflow/rna-seq.nf --deriva ./test_data/auth/credential.json --bdbag ./test_data/auth/cookies.txt --repRID Q-Y5ER --source staging --spikeForce t --upload false --dev false --ci true -with-report ./spikeOverride_report.html
   - find . -type f -name "multiqc_data.json" -exec cp {} ./spikeOverride_PE_multiqc_data.json \;
-  - pytest -m completionOverride_spike
+  - pytest -m completion("spikedOverride_PE_multiqc_data.json")
   artifacts:
     name: "$CI_JOB_NAME"
     when: always
diff --git a/workflow/tests/test_alignReads.py b/workflow/tests/test_alignReads.py
index 11f0f3d..06429a5 100644
--- a/workflow/tests/test_alignReads.py
+++ b/workflow/tests/test_alignReads.py
@@ -5,25 +5,25 @@ import pandas as pd
 import os
 import utils
 
-data_output_path = os.path.dirname(os.path.abspath(__file__)) + \
+test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
     '/../../'
 
 
 @pytest.mark.alignData
 def test_alignData_se():
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.unal.gz'))
+        test_output_path, 'Q-Y5F6_1M.se.unal.gz'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.sorted.bam'))
+        test_output_path, 'Q-Y5F6_1M.se.sorted.bam'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.sorted.bam.bai'))
+        test_output_path, 'Q-Y5F6_1M.se.sorted.bam.bai'))
 
 
 @pytest.mark.alignData
 def test_alignData_pe():
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.pe.unal.gz'))
+        test_output_path, 'Q-Y5F6_1M.pe.unal.gz'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.pe.sorted.bam'))
+        test_output_path, 'Q-Y5F6_1M.pe.sorted.bam'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.pe.sorted.bam.bai'))
+        test_output_path, 'Q-Y5F6_1M.pe.sorted.bam.bai'))
diff --git a/workflow/tests/test_completion.py b/workflow/tests/test_completion.py
index ee7701b..85ac430 100644
--- a/workflow/tests/test_completion.py
+++ b/workflow/tests/test_completion.py
@@ -10,43 +10,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
     '/../../'
 
 
-@pytest.mark.completionIntegration_se
-def test_multiqc():
+@pytest.mark.completion
+def test_multiqc(file_name):
     assert os.path.exists(os.path.join(
-        test_output_path, 'SE_multiqc_data.json'))
-
-
-@pytest.mark.completionIntegration_pe
-def test_multiqc():
-    assert os.path.exists(os.path.join(
-        test_output_path, 'PE_multiqc_data.json'))
-
-
-@pytest.mark.completionOverride_inputBag
-def test_multiqc():
-    assert os.path.exists(os.path.join(
-        test_output_path, 'inputBagOverride_PE_multiqc_data.json'))
-
-
-@pytest.mark.completionOverride_fastq
-def test_multiqc():
-    assert os.path.exists(os.path.join(
-        test_output_path, 'fastqOverride_PE_multiqc_data.json'))
-
-
-@pytest.mark.completionOverride_species
-def test_multiqc():
-    assert os.path.exists(os.path.join(
-        test_output_path, 'speciesOverride_PE_multiqc_data.json'))
-
-
-@pytest.mark.completionOverride_stranded
-def test_multiqc():
-    assert os.path.exists(os.path.join(
-        test_output_path, 'strandedOverride_PE_multiqc_data.json'))
-
-
-@pytest.mark.completionOverride_spike
-def test_multiqc():
-    assert os.path.exists(os.path.join(
-        test_output_path, 'spikeOverride_PE_multiqc_data.json'))
\ No newline at end of file
+        test_output_path, file_name))
\ No newline at end of file
diff --git a/workflow/tests/test_dedupReads.py b/workflow/tests/test_dedupReads.py
index 89fc2b1..15e227d 100644
--- a/workflow/tests/test_dedupReads.py
+++ b/workflow/tests/test_dedupReads.py
@@ -5,25 +5,25 @@ import pandas as pd
 import os
 import utils
 
-data_output_path = os.path.dirname(os.path.abspath(__file__)) + \
+test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
     '/../../'
 
 
 @pytest.mark.dedupData
 def test_dedupData():
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.bam'))
+        test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.bam'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.bam.bai'))
+        test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.bam.bai'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr8.bam'))
+        test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr8.bam'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr8.bam.bai'))
+        test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr8.bam.bai'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr4.bam'))
+        test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr4.bam'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr4.bam.bai'))
+        test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chr4.bam.bai'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chrY.bam'))
+        test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chrY.bam'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chrY.bam.bai'))
+        test_output_path, 'Q-Y5F6_1M.se.sorted.deduped.chrY.bam.bai'))
diff --git a/workflow/tests/test_makeBigWig.py b/workflow/tests/test_makeBigWig.py
index d8f62f5..273b2cd 100644
--- a/workflow/tests/test_makeBigWig.py
+++ b/workflow/tests/test_makeBigWig.py
@@ -5,10 +5,10 @@ import pandas as pd
 import os
 import utils
 
-data_output_path = os.path.dirname(os.path.abspath(__file__)) + \
+test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
     '/../../'
 
 
 @pytest.mark.makeBigWig
 def test_makeBigWig():
-    assert os.path.exists(os.path.join(data_output_path, 'Q-Y5F6_1M.se.bw'))
+    assert os.path.exists(os.path.join(test_output_path, 'Q-Y5F6_1M.se.bw'))
diff --git a/workflow/tests/test_makeFeatureCounts.py b/workflow/tests/test_makeFeatureCounts.py
index e147935..43e6810 100644
--- a/workflow/tests/test_makeFeatureCounts.py
+++ b/workflow/tests/test_makeFeatureCounts.py
@@ -5,15 +5,15 @@ import pandas as pd
 import os
 import utils
 
-data_output_path = os.path.dirname(os.path.abspath(__file__)) + \
+test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
     '/../../'
 
 
 @pytest.mark.makeFeatureCounts
 def test_makeFeatureCounts():
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se_countData'))
+        test_output_path, 'Q-Y5F6_1M.se_countData'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se.countTable.csv'))
+        test_output_path, 'Q-Y5F6_1M.se.countTable.csv'))
     assert os.path.exists(os.path.join(
-        data_output_path, 'Q-Y5F6_1M.se_tpmTable.csv'))
+        test_output_path, 'Q-Y5F6_1M.se_tpmTable.csv'))
-- 
GitLab