diff --git a/tests/conda/README.md b/tests/conda/README.md new file mode 100644 index 00000000..5c6e1a26 --- /dev/null +++ b/tests/conda/README.md @@ -0,0 +1,57 @@ +# Overview of tests for the conda buildpack + +## py2 + +- Test setup of a Python 2 environment by declaring `python=2` in + `environment.yml`. + +## py35-binder-dir + +- Test setup of a Python 3.5 environment by declaring `python=3.5` in + `environment.yml`. + + The reasons for testing 3.5 specifically is that it is the oldest version of + Python 3 supported by repo2docker's conda buildpack. See + `repo2docker/buildpacks/conda` for details. + +- Test use of a `.binder` directory, where files outside it shouldn't be + considered. See [this documentation](https://repo2docker.readthedocs.io/en/latest/usage.html#where-to-put-configuration-files) + for details. + +## py310-requirements-file + +- Test setup of a Python 3.10 environment by declaring `python=3.10` in + `environment.yml`. + + The reasons for testing 3.10 specifically is that it is the newest version of + Python 3 supported by repo2docker's conda buildpack. See + `repo2docker/buildpacks/conda` for details. + +- Test use of a `requirements.txt` file, where an `environment.yml` file should + take precedence and the `requirements.txt` should be ignored. + +## r-postbuild-file + +- Test setup of the default Python environment by omitting `python` from + `environment.yml` file. + +- Test setup of the default R environment by specifying `r-base` in + `environment.yml`. + +- Test use of a `postBuild` file. See [this documentation](https://repo2docker.readthedocs.io/en/latest/config_files.html#postbuild-run-code-after-installing-the-environment) + for details. + +## r3.6-target-repo-dir-flag + +- Test setup of a R 3.6 environment by specifying `r-base=3.6` in + `environment.yml`. + +- Test use of repo2docker with the `--target-repo-dir` flag. See [this documentation](https://repo2docker.readthedocs.io/en/latest/usage.html#cmdoption-jupyter-repo2docker-target-repo-dir) + for details. + + `--target-repo-dir` is meant to support custom paths where repositories can be + copied to besides `${HOME}`. + + This test makes use of the `test-extra-args.yaml` file to influence additional + arguments passed to `repo2docker` during the test. In this test, specify + `--target-repo-dir=/srv/repo`. diff --git a/tests/conda/py2/README.rst b/tests/conda/py2/README.rst deleted file mode 100644 index d0459de9..00000000 --- a/tests/conda/py2/README.rst +++ /dev/null @@ -1,4 +0,0 @@ -Python 2 --------- - -Test setup of a Python 2 environment. diff --git a/tests/conda/py310-requirements-file/README.rst b/tests/conda/py310-requirements-file/README.rst deleted file mode 100644 index fc5b564b..00000000 --- a/tests/conda/py310-requirements-file/README.rst +++ /dev/null @@ -1,17 +0,0 @@ -Python 3.10 (latest), and an ignored requirements file ------------------------------------------------------- - -The reasons for testing 3.10 specifically is that it is the latest version of -Python 3 supported by repo2docker's conda buildpack. See -``repo2docker/buildpacks/conda`` for details. - -An ``environment.yml`` file takes precedence over ``requirements.txt``. -To install Python packages into a conda environment with pip, use the -``pip`` key in ``environment.yml``: - -.. sourcecode:: yaml - - dependencies: - - numpy - - pip: - - tornado diff --git a/tests/conda/py310-requirements-file/environment.yml b/tests/conda/py310-requirements-file/environment.yml index 810a05d0..192eba40 100644 --- a/tests/conda/py310-requirements-file/environment.yml +++ b/tests/conda/py310-requirements-file/environment.yml @@ -1,5 +1,6 @@ dependencies: - python=3.10 - numpy + - pip - pip: - - simplejson + - simplejson diff --git a/tests/conda/py35-binder-dir/README.rst b/tests/conda/py35-binder-dir/README.rst deleted file mode 100644 index 1df45db3..00000000 --- a/tests/conda/py35-binder-dir/README.rst +++ /dev/null @@ -1,9 +0,0 @@ -Python 3.5, and a dedicated binder folder ------------------------------------------ - -Test setup of Python 3.5 and the use of a dedicated binder folder that should -make files in the root directory be ignored. - -The reasons for testing 3.5 specifically is that it is the oldest version of -Python 3 supported by repo2docker's conda buildpack. See -``repo2docker/buildpacks/conda`` for details. diff --git a/tests/conda/r-postbuild/environment.yml b/tests/conda/r-postbuild-file/environment.yml similarity index 100% rename from tests/conda/r-postbuild/environment.yml rename to tests/conda/r-postbuild-file/environment.yml diff --git a/tests/conda/r-postbuild/postBuild b/tests/conda/r-postbuild-file/postBuild similarity index 100% rename from tests/conda/r-postbuild/postBuild rename to tests/conda/r-postbuild-file/postBuild diff --git a/tests/conda/r-postbuild/verify b/tests/conda/r-postbuild-file/verify similarity index 100% rename from tests/conda/r-postbuild/verify rename to tests/conda/r-postbuild-file/verify diff --git a/tests/conda/r-postbuild/verify.py b/tests/conda/r-postbuild-file/verify.py similarity index 100% rename from tests/conda/r-postbuild/verify.py rename to tests/conda/r-postbuild-file/verify.py diff --git a/tests/conda/r-postbuild/README.rst b/tests/conda/r-postbuild/README.rst deleted file mode 100644 index 3a1b50d2..00000000 --- a/tests/conda/r-postbuild/README.rst +++ /dev/null @@ -1,6 +0,0 @@ -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/r3.6-extra-args/README.rst b/tests/conda/r3.6-extra-args/README.rst deleted file mode 100644 index cb3e1f85..00000000 --- a/tests/conda/r3.6-extra-args/README.rst +++ /dev/null @@ -1,7 +0,0 @@ -R 3.6, and an extra-args.yaml file ----------------------------------- - -We want to support custom paths where repositories can be copied to, instead of -${HOME}. The `extra-args.yaml` file in each dir can contain a list of arguments -that are passed to repo2docker during the test. We copy this repo to /srv/repo -instead of ${HOME} diff --git a/tests/conda/r3.6-extra-args/extra-args.yaml b/tests/conda/r3.6-extra-args/extra-args.yaml deleted file mode 100644 index 8687775b..00000000 --- a/tests/conda/r3.6-extra-args/extra-args.yaml +++ /dev/null @@ -1,2 +0,0 @@ -- --target-repo-dir -- /srv/repo \ No newline at end of file diff --git a/tests/conda/r3.6-extra-args/environment.yml b/tests/conda/r3.6-target-repo-dir-flag/environment.yml similarity index 100% rename from tests/conda/r3.6-extra-args/environment.yml rename to tests/conda/r3.6-target-repo-dir-flag/environment.yml diff --git a/tests/conda/r3.6-target-repo-dir-flag/test-extra-args.yaml b/tests/conda/r3.6-target-repo-dir-flag/test-extra-args.yaml new file mode 100644 index 00000000..84ef1376 --- /dev/null +++ b/tests/conda/r3.6-target-repo-dir-flag/test-extra-args.yaml @@ -0,0 +1,4 @@ +# This file is respected by repo2docker's test suite, but not repo2docker +# itself. It is used solely to help us test command line flags. +# +- --target-repo-dir=/srv/repo diff --git a/tests/conda/r3.6-extra-args/verify b/tests/conda/r3.6-target-repo-dir-flag/verify similarity index 90% rename from tests/conda/r3.6-extra-args/verify rename to tests/conda/r3.6-target-repo-dir-flag/verify index 084694a2..bff7d8b0 100755 --- a/tests/conda/r3.6-extra-args/verify +++ b/tests/conda/r3.6-target-repo-dir-flag/verify @@ -5,7 +5,7 @@ jupyter nbextension list 2>&1 | grep jupyter_server_proxy R -e "library('digest')" -# Fail if version is not 3.6 +# Fail if R version is not 3.6 R --version R -e 'if (!(version$major == "3" && as.double(version$minor) >= 6 && as.double(version$minor) < 7)) quit("yes", 1)' diff --git a/tests/conda/r3.6-extra-args/verify.py b/tests/conda/r3.6-target-repo-dir-flag/verify.py similarity index 100% rename from tests/conda/r3.6-extra-args/verify.py rename to tests/conda/r3.6-target-repo-dir-flag/verify.py diff --git a/tests/conftest.py b/tests/conftest.py index 160b3664..46860ab2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -198,7 +198,7 @@ class LocalRepo(pytest.File): args = ["--appendix", 'RUN echo "appendix" > /tmp/appendix'] # If there's an extra-args.yaml file in a test dir, assume it contains # a yaml list with extra arguments to be passed to repo2docker - extra_args_path = os.path.join(self.fspath.dirname, "extra-args.yaml") + extra_args_path = os.path.join(self.fspath.dirname, "test-extra-args.yaml") if os.path.exists(extra_args_path): with open(extra_args_path) as f: extra_args = yaml.safe_load(f)