Skip to content
Commits on Source (3)
......@@ -8,9 +8,12 @@ snakemake (5.1.5-1) UNRELEASED; urgency=medium
* Build-Depends: r-cran-rmarkdown and disable patch that skips test using
RMarkdown
* Recommends: r-cran-rmarkdown
* Build-Depends: python3-datrie, python3-networkx, python3-recommonmark
* (Build-)Depends: python3-datrie, python3-networkx, python3-recommonmark,
python3-pygraphviz, python3-pytest
* Point Vcs-fields to Salsa
* Drop X-Python-Version
* Merge upstream commit to skip tests needing network access (upstream issue
#902)
-- Andreas Tille <tille@debian.org> Tue, 26 Jun 2018 11:18:08 +0200
......
......@@ -12,6 +12,7 @@ Build-Depends: debhelper (>= 11~),
python3-networkx,
python3-nose,
python3-psutil,
python3-pygraphviz,
python3-pytools,
python3-ratelimiter,
python3-recommonmark,
......@@ -22,6 +23,7 @@ Build-Depends: debhelper (>= 11~),
python3-wrapt,
python3-yaml,
python3-sphinx-rtd-theme,
python3-pytest,
ca-certificates,
r-cran-rmarkdown
Standards-Version: 4.1.4
......@@ -39,6 +41,7 @@ Depends: ${misc:Depends},
python3-datrie,
python3-networkx,
python3-psutil,
python3-pygraphviz,
python3-pytools,
python3-ratelimiter,
python3-recommonmark,
......
Origin: https://bitbucket.org/snakemake/snakemake/commits/4741705d0b07e1131ed0cc940b53a802f49ead42
Description: Skip tests on missing inet connection or if not in CI.
Author: Johannes Köster <johannes.koester@tu-dortmund.de>
Last-Update: Mon Jul 9 11:30:23 2018 +0200
Bug-Upstream: https://bitbucket.org/snakemake/snakemake/issues/902/how-to-reliably-exclude-tests-requiring
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -13,6 +13,7 @@ import hashlib
import urllib
from shutil import rmtree, which
from shlex import quote
+import pytest
from snakemake import snakemake
from snakemake.shell import shell
@@ -43,6 +44,18 @@ def is_connected():
return False
+def is_ci():
+ return "CI" in os.environ
+
+
+def has_gcloud_service_key():
+ return "GCLOUD_SERVICE_KEY" in os.environ
+
+
+def has_gcloud_cluster():
+ return "GCLOUD_CLUSTER" in os.environ
+
+
def copy(src, dst):
if os.path.isdir(src):
shutil.copytree(src, os.path.join(dst, os.path.basename(src)))
@@ -52,7 +65,6 @@ def copy(src, dst):
def run(path,
shouldfail=False,
- needs_connection=False,
snakefile="Snakefile",
subpath=None,
check_md5=True, cores=3, **params):
@@ -61,12 +73,6 @@ def run(path,
There must be a Snakefile in the path and a subdirectory named
expected-results.
"""
-
- if needs_connection and not is_connected():
- print("Skipping test because of missing internet connection",
- file=sys.stderr)
- return False
-
results_dir = join(path, 'expected-results')
snakefile = join(path, snakefile)
assert os.path.exists(snakefile)
@@ -254,8 +260,9 @@ def test_persistent_dict():
pass
+@pytest.mark.skipif(not is_connected(), reason="no internet connection")
def test_url_include():
- run(dpath("test_url_include"), needs_connection=True)
+ run(dpath("test_url_include"))
def test_touch():
@@ -444,6 +451,7 @@ def test_spaces_in_fnames():
# pass
+@pytest.mark.skipif(not is_connected(), reason="no internet connection")
def test_remote_ncbi_simple():
try:
import Bio
@@ -454,6 +462,7 @@ def test_remote_ncbi_simple():
except ImportError:
pass
+@pytest.mark.skipif(not is_connected(), reason="no internet connection")
def test_remote_ncbi():
try:
import Bio
@@ -465,6 +474,7 @@ def test_remote_ncbi():
pass
+@pytest.mark.skipif(not is_ci(), reason="not in CI")
def test_remote_irods():
if os.environ.get("CI") == "true":
run(dpath("test_remote_irods"))
@@ -569,6 +579,8 @@ def test_run_namedlist():
run(dpath("test_run_namedlist"))
+@pytest.mark.skipif(not is_connected(), reason="no internet connection")
+@pytest.mark.skipif(not is_ci(), reason="not in CI")
def test_remote_gs():
if not "CI" in os.environ:
run(dpath("test_remote_gs"))
@@ -576,13 +588,17 @@ def test_remote_gs():
print("skipping test_remove_gs in CI")
+@pytest.mark.skipif(not is_connected(), reason="no internet connection")
def test_remote_log():
run(dpath("test_remote_log"), shouldfail=True)
+@pytest.mark.skipif(not is_connected(), reason="no internet connection")
def test_remote_http():
run(dpath("test_remote_http"))
+
+@pytest.mark.skipif(not is_connected(), reason="no internet connection")
def test_remote_http_cluster():
run(dpath("test_remote_http"), cluster=os.path.abspath(dpath("test14/qsub")))
@@ -590,6 +606,7 @@ def test_profile():
run(dpath("test_profile"))
+@pytest.mark.skipif(not is_connected(), reason="no internet connection")
def test_singularity():
run(dpath("test_singularity"), use_singularity=True)
@@ -613,28 +630,52 @@ def test_archive():
def test_log_input():
run(dpath("test_log_input"))
-
+@pytest.mark.skipif(not is_connected(), reason="no internet connection")
+@pytest.mark.skipif(not is_ci(), reason="no in CI")
+@pytest.mark.skipif(not has_gcloud_service_key(), reason="GCLOUD_SERVICE_KEY undefined")
+@pytest.mark.skipif(not has_gcloud_cluster(), reason="GCLOUD_CLUSTER undefined")
def test_gcloud():
- if "CI" in os.environ and "GCLOUD_SERVICE_KEY" in os.environ:
- cluster = os.environ["GCLOUD_CLUSTER"]
- try:
- shell("""
- sudo $GCLOUD container clusters create {cluster} --num-nodes 3 --scopes storage-rw --zone us-central1-a --machine-type f1-micro
- sudo $GCLOUD container clusters get-credentials {cluster} --zone us-central1-a
- """)
- run(dpath("test_kubernetes"))
- run(dpath("test_kubernetes"), use_conda=True)
- run(dpath("test_kubernetes"), use_singularity=True)
- run(dpath("test_kubernetes"), use_singularity=True, use_conda=True)
- finally:
- shell("sudo $GCLOUD container clusters delete {cluster} --zone us-central1-a --quiet")
- print("Skipping google cloud test")
+ cluster = os.environ["GCLOUD_CLUSTER"]
+ bucket_name = 'snakemake-testing-{}'.format(cluster)
+
+ def run_kubernetes(**kwargs):
+ run(dpath("test_kubernetes"),
+ kubernetes="default",
+ default_remote_provider="GS",
+ default_remote_prefix=bucket_name,
+ no_tmpdir=True,
+ **kwargs)
+ def reset():
+ shell('$GSUTIL rm -r gs://{}/*'.format(bucket_name))
+
+ try:
+ shell("""
+ $GCLOUD container clusters create {cluster} --num-nodes 3 --scopes storage-rw --zone us-central1-a --machine-type f1-micro
+ $GCLOUD container clusters get-credentials {cluster} --zone us-central1-a
+ $GSUTIL mb gs://{bucket_name}
+ """)
+ run_kubernetes()
+ reset()
+ run_kubernetes(use_conda=True)
+ reset()
+ run_kubernetes(use_singularity=True)
+ reset()
+ run_kubernetes(use_singularity=True, use_conda=True)
+ reset()
+ except:
+ shell("for p in `kubectl get pods | grep ^snakejob- | cut -f 1 -d ' '`; do kubectl logs $p; done")
+ finally:
+ shell("""
+ $GCLOUD container clusters delete {cluster} --zone us-central1-a --quiet
+ $GSUTIL rm -r gs://{bucket_name}
+ """)
+@pytest.mark.skipif(not is_connected(), reason="no internet connection")
def test_cwl():
run(dpath("test_cwl"))
-
+@pytest.mark.skipif(not is_connected(), reason="no internet connection")
def test_cwl_singularity():
run(dpath("test_cwl"), use_singularity=True)
0001-Use-the-inbuild-sphinx.ext.napoleon.patch
0003-Use-debian-s-mathjax-package.patch
0003-Compat-fix.patch
0004-drop_test_symlink_time_handling.patch
# 0004-drop_test_symlink_time_handling.patch
# 0005-drop_test_symlink_temp.patch - should be fixed in commit d697f23
0006-restore-bin.patch
# 0007-noop-rate-limiter.patch - broken and obsolete with https://bugs.debian.org/880661
......@@ -9,3 +9,4 @@
0009-skip-test-without-google-cloud-sdk.patch
# 0010-skip-test-without-rmarkdown.patch
0011-fix-privacy-breach.patch
0012-skip_test_needing_networ_connection.patch