From ee0828f0b15d6977719c95b7b0b5610c2a7a2b97 Mon Sep 17 00:00:00 2001
From: Venkat Malladi <venkat.malladi@utsouthwestern.edu>
Date: Sat, 9 Mar 2019 22:03:16 -0600
Subject: [PATCH] Update tests and add a skip test that only runs on branches.

---
 .gitlab-ci.yml                        | 15 ++++++++++++++-
 workflow/tests/test_annotate_peaks.py |  1 +
 workflow/tests/test_diff_peaks.py     | 11 +++++++----
 workflow/tests/test_motif_search.py   |  7 ++++++-
 4 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6d2c02b..e5ff36c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,6 +8,7 @@ stages:
   - unit
   - single
   - multiple
+  - skip
 
 user_configuration:
   stage: unit
@@ -47,7 +48,7 @@ single_end_diff:
     - master
   script:
   - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_SE.txt" --genome 'GRCm38' -resume
-  - pytest -m singlediff
+  - pytest -m singlediff singlediff_true
   artifacts:
     expire_in: 2 days
 
@@ -62,3 +63,15 @@ paired_end_diff:
   - pytest -m paireddiff
   artifacts:
     expire_in: 2 days
+
+single_end_skip:
+  stage: multiple
+  only:
+    - branches
+  except:
+    - master
+  script:
+  - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_SE.txt" --genome 'GRCm38' --skipDiff true --skipMotif true -resume
+  - pytest -m singlediff singleskip_true
+  artifacts:
+    expire_in: 2 days
diff --git a/workflow/tests/test_annotate_peaks.py b/workflow/tests/test_annotate_peaks.py
index ee3ebe1..1342a12 100644
--- a/workflow/tests/test_annotate_peaks.py
+++ b/workflow/tests/test_annotate_peaks.py
@@ -19,6 +19,7 @@ def test_pie_singleend():
 def test_upsetplot_singleend():
     assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC.chipseeker_upsetplot.pdf'))
 
+
 @pytest.mark.singleend
 def test_annotation_singleend():
     annotation_file = test_output_path + 'ENCSR238SGC.chipseeker_annotation.tsv'
diff --git a/workflow/tests/test_diff_peaks.py b/workflow/tests/test_diff_peaks.py
index b0a76aa..29868ee 100644
--- a/workflow/tests/test_diff_peaks.py
+++ b/workflow/tests/test_diff_peaks.py
@@ -11,29 +11,32 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
 
 
 @pytest.mark.singleend
+@pytest.mark.singleskip_true
 def test_diff_peaks_singleend_single_rep():
     assert os.path.isdir(test_output_path) == False
 
+
 @pytest.mark.pairedend
 def test_diff_peaks_pairedend_single_rep():
     assert os.path.isdir(test_output_path) == False
 
-@pytest.mark.singlediff
+
+@pytest.mark.singlediff_true
 def test_heatmap_singleend_multiple_rep():
     assert os.path.exists(os.path.join(test_output_path, 'heatmap.pdf'))
 
 
-@pytest.mark.singlediff
+@pytest.mark.singlediff_true
 def test_pca_singleend_multiple_rep():
     assert os.path.exists(os.path.join(test_output_path, 'pca.pdf'))
 
 
-@pytest.mark.singlediff
+@pytest.mark.singlediff_true
 def test_normcount_singleend_multiple_rep():
     assert os.path.exists(os.path.join(test_output_path, 'normcount_peaksets.txt'))
 
 
-@pytest.mark.singlediff
+@pytest.mark.singlediff_true
 def test_diffbind_singleend_multiple_rep():
     if os.path.isfile(os.path.join(test_output_path, 'ENCSR272GNQ_vs_ENCSR238SGC_diffbind.bed')):
         assert os.path.exists(os.path.join(test_output_path, 'ENCSR272GNQ_vs_ENCSR238SGC_diffbind.bed'))
diff --git a/workflow/tests/test_motif_search.py b/workflow/tests/test_motif_search.py
index 8c12652..28aec04 100644
--- a/workflow/tests/test_motif_search.py
+++ b/workflow/tests/test_motif_search.py
@@ -23,13 +23,18 @@ def test_motif_search_singleend():
     assert os.path.exists(os.path.join(test_output_path, 'ENCSR238SGC_memechip', 'index.html'))
 
 
+@pytest.mark.singleskip_true
+def test_motif_search_singleend():
+    assert os.path.isdir(test_output_path) == False
+
+
 @pytest.mark.pairedend
 def test_limited_peaks_pairedend():
     peak_file_ENCSR729LGA= test_output_path + 'ENCSR729LGA.600.narrowPeak'
     assert os.path.exists(peak_file_ENCSR729LGA)
     assert utils.count_lines(peak_file_ENCSR729LGA) == 600
 
-    
+
 @pytest.mark.pairedend
 def test_motif_search_pairedend():
     assert os.path.exists(os.path.join(test_output_path, 'ENCSR729LGA_memechip',  'ENCSR729LGA.fa'))
-- 
GitLab