From f1b13395076398f969437687dd22b43ffddceb82 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Sun, 9 Oct 2022 19:02:23 +0200 Subject: [PATCH] ci: refactor conda tests, from 6 to 5 (~5 min saved) With this commit, we combine testing the default python version installation into the default R version installation test. --- tests/conda/py-postbuild/README.rst | 6 ------ tests/conda/py-postbuild/environment.yml | 3 --- tests/conda/py-postbuild/verify | 2 -- tests/conda/r-postbuild/README.rst | 6 ++++++ tests/conda/{r => r-postbuild}/environment.yml | 1 + tests/conda/{py-postbuild => r-postbuild}/postBuild | 0 tests/conda/{r => r-postbuild}/verify | 2 ++ tests/conda/{py-postbuild => r-postbuild}/verify.py | 6 ++---- tests/conda/r/README.rst | 5 ----- tests/conda/r3.6-extra-args/verify.py | 4 ++-- 10 files changed, 13 insertions(+), 22 deletions(-) delete mode 100644 tests/conda/py-postbuild/README.rst delete mode 100644 tests/conda/py-postbuild/environment.yml delete mode 100755 tests/conda/py-postbuild/verify create mode 100644 tests/conda/r-postbuild/README.rst rename tests/conda/{r => r-postbuild}/environment.yml (77%) rename tests/conda/{py-postbuild => r-postbuild}/postBuild (100%) rename tests/conda/{r => r-postbuild}/verify (87%) rename tests/conda/{py-postbuild => r-postbuild}/verify.py (74%) delete mode 100644 tests/conda/r/README.rst mode change 100644 => 100755 tests/conda/r3.6-extra-args/verify.py diff --git a/tests/conda/py-postbuild/README.rst b/tests/conda/py-postbuild/README.rst deleted file mode 100644 index a0a82bb0..00000000 --- a/tests/conda/py-postbuild/README.rst +++ /dev/null @@ -1,6 +0,0 @@ -Default Python, and an postBuild file -------------------------------------- - -We test the default Python version set by repo2docker as used when an -environment.yml file is provided without a ``python`` dependency, and the use of -a ``postBuild`` file. diff --git a/tests/conda/py-postbuild/environment.yml b/tests/conda/py-postbuild/environment.yml deleted file mode 100644 index c8a54544..00000000 --- a/tests/conda/py-postbuild/environment.yml +++ /dev/null @@ -1,3 +0,0 @@ -dependencies: - - numpy - - pytest diff --git a/tests/conda/py-postbuild/verify b/tests/conda/py-postbuild/verify deleted file mode 100755 index 058dbed0..00000000 --- a/tests/conda/py-postbuild/verify +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -pytest -v ./verify.py diff --git a/tests/conda/r-postbuild/README.rst b/tests/conda/r-postbuild/README.rst new file mode 100644 index 00000000..3a1b50d2 --- /dev/null +++ b/tests/conda/r-postbuild/README.rst @@ -0,0 +1,6 @@ +Default R, default Python, and a postBuild file +----------------------------------------------- + +We test the default R and Python version set by repo2docker as used when an +environment.yml file is provided without a ``python`` or ``r-base`` dependency +pinned, and the use of a ``postBuild`` file. diff --git a/tests/conda/r/environment.yml b/tests/conda/r-postbuild/environment.yml similarity index 77% rename from tests/conda/r/environment.yml rename to tests/conda/r-postbuild/environment.yml index 786ea0e2..9ff3d3db 100644 --- a/tests/conda/r/environment.yml +++ b/tests/conda/r-postbuild/environment.yml @@ -1,3 +1,4 @@ dependencies: + - pytest - r-base - r-digest diff --git a/tests/conda/py-postbuild/postBuild b/tests/conda/r-postbuild/postBuild similarity index 100% rename from tests/conda/py-postbuild/postBuild rename to tests/conda/r-postbuild/postBuild diff --git a/tests/conda/r/verify b/tests/conda/r-postbuild/verify similarity index 87% rename from tests/conda/r/verify rename to tests/conda/r-postbuild/verify index 9fdacac4..552036ea 100755 --- a/tests/conda/r/verify +++ b/tests/conda/r-postbuild/verify @@ -8,3 +8,5 @@ R -e "library('digest')" # Fail if version is not at least 4.2 R --version R -e 'if (!(version$major == "4" && as.double(version$minor) >= 2)) quit("yes", 1)' + +pytest --verbose --color=yes ./verify.py diff --git a/tests/conda/py-postbuild/verify.py b/tests/conda/r-postbuild/verify.py similarity index 74% rename from tests/conda/py-postbuild/verify.py rename to tests/conda/r-postbuild/verify.py index dc80f471..549a05a1 100755 --- a/tests/conda/py-postbuild/verify.py +++ b/tests/conda/r-postbuild/verify.py @@ -4,14 +4,12 @@ import sys def test_sys_version(): + """The default python version should be 3.7""" assert sys.version_info[:2] == (3, 7) -def test_numpy(): - import numpy - - def test_there(): + """there is to be installed via postBuild""" import there diff --git a/tests/conda/r/README.rst b/tests/conda/r/README.rst deleted file mode 100644 index 63f1e68f..00000000 --- a/tests/conda/r/README.rst +++ /dev/null @@ -1,5 +0,0 @@ -Default R ---------- - -We test the default R version set by repo2docker as used when r-base is -specified without a version in an environment.yml file. diff --git a/tests/conda/r3.6-extra-args/verify.py b/tests/conda/r3.6-extra-args/verify.py old mode 100644 new mode 100755 index 9bfddeb1..706dc41a --- a/tests/conda/r3.6-extra-args/verify.py +++ b/tests/conda/r3.6-extra-args/verify.py @@ -10,8 +10,8 @@ assert sys.executable == os.path.join( assert sys.executable.startswith("/srv/conda/"), sys.executable # Repo should be in /srv/repo -assert os.path.exists("/srv/repo/verify") -assert os.path.abspath(__file__) == "/srv/repo/verify" +assert os.path.exists("/srv/repo/verify.py") +assert os.path.abspath(__file__) == "/srv/repo/verify.py" # Repo should be writable assert os.access("/srv/repo", os.W_OK)