kopia lustrzana https://github.com/jupyterhub/repo2docker
ci: refactor conda tests, from 11 to 6 (~20 min saved)
rodzic
2c0b14c7da
commit
f69d65feb9
|
@ -1,2 +0,0 @@
|
||||||
FROM doesntmatter
|
|
||||||
# this file should be ignored because there's a binder dir
|
|
|
@ -1,3 +0,0 @@
|
||||||
dependencies:
|
|
||||||
- thiswontwork
|
|
||||||
invalid
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# install pytest with conda in the default env (should be $KERNEL_PYTHON_PREFIX)
|
|
||||||
conda install -yq pytest
|
|
||||||
# install there with pip (should be the same)
|
|
||||||
pip install there
|
|
|
@ -1,13 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def test_sys_prefix():
|
|
||||||
# verify that pytest was installed in the notebook env
|
|
||||||
assert sys.prefix == os.environ["KERNEL_PYTHON_PREFIX"]
|
|
||||||
|
|
||||||
|
|
||||||
def test_there():
|
|
||||||
# verify that there was installed in the notebook env
|
|
||||||
import there
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
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.
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
pip install there
|
|
@ -11,6 +11,10 @@ def test_numpy():
|
||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
|
|
||||||
|
def test_there():
|
||||||
|
import there
|
||||||
|
|
||||||
|
|
||||||
def test_conda_activated():
|
def test_conda_activated():
|
||||||
assert os.environ.get("CONDA_PREFIX") == os.environ["NB_PYTHON_PREFIX"], dict(
|
assert os.environ.get("CONDA_PREFIX") == os.environ["NB_PYTHON_PREFIX"], dict(
|
||||||
os.environ
|
os.environ
|
|
@ -0,0 +1,4 @@
|
||||||
|
Python 2
|
||||||
|
--------
|
||||||
|
|
||||||
|
Test setup of a Python 2 environment.
|
|
@ -0,0 +1,17 @@
|
||||||
|
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
|
|
@ -1,4 +1,5 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
|
- python=3.10
|
||||||
- numpy
|
- numpy
|
||||||
- pip:
|
- pip:
|
||||||
- simplejson
|
- simplejson
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
assert sys.version_info[:2] == (3, 7), sys.version
|
assert sys.version_info[:2] == (3, 10), sys.version
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
dependencies:
|
|
||||||
- python=3.10
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
import sys
|
|
||||||
|
|
||||||
assert sys.version_info[:2] == (3, 10), sys.version
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# This file should be ignored because there's a dedicated binder folder
|
||||||
|
FROM doesntmatter
|
|
@ -0,0 +1,9 @@
|
||||||
|
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.
|
|
@ -0,0 +1,4 @@
|
||||||
|
# This file should be ignored as we have a dedicated binder folder.
|
||||||
|
dependencies:
|
||||||
|
- thiswontwork
|
||||||
|
invalid
|
|
@ -1,2 +0,0 @@
|
||||||
dependencies:
|
|
||||||
- python=3.7
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
import sys
|
|
||||||
|
|
||||||
assert sys.version_info[:2] == (3, 7), sys.version
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
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.
|
|
@ -1,3 +1,3 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- r-base
|
- r-base
|
||||||
- r-ggplot2
|
- r-digest
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
jupyter serverextension list 2>&1 | grep jupyter_server_proxy
|
jupyter serverextension list 2>&1 | grep jupyter_server_proxy
|
||||||
jupyter nbextension list 2>&1 | grep jupyter_server_proxy
|
jupyter nbextension list 2>&1 | grep jupyter_server_proxy
|
||||||
R -e "library('ggplot2')"
|
|
||||||
# Fail if version is not at least 4.1
|
R -e "library('digest')"
|
||||||
R -e 'if (!(version$major == "4" && as.double(version$minor) >= 1)) quit("yes", 1)'
|
|
||||||
|
# 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)'
|
|
@ -0,0 +1,7 @@
|
||||||
|
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}
|
|
@ -1,3 +1,3 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
- r-base=3.6
|
- r-base=3.6
|
||||||
- r-testthat
|
- r-digest
|
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
jupyter serverextension list 2>&1 | grep jupyter_server_proxy
|
jupyter serverextension list 2>&1 | grep jupyter_server_proxy
|
||||||
jupyter nbextension list 2>&1 | grep jupyter_server_proxy
|
jupyter nbextension list 2>&1 | grep jupyter_server_proxy
|
||||||
R -e "library('testthat')"
|
|
||||||
|
R -e "library('digest')"
|
||||||
|
|
||||||
# Fail if version is not 3.6
|
# Fail if 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)'
|
R -e 'if (!(version$major == "3" && as.double(version$minor) >= 6 && as.double(version$minor) < 7)) quit("yes", 1)'
|
||||||
|
|
||||||
|
./verify.py
|
|
@ -15,6 +15,3 @@ assert os.path.abspath(__file__) == "/srv/repo/verify"
|
||||||
|
|
||||||
# Repo should be writable
|
# Repo should be writable
|
||||||
assert os.access("/srv/repo", os.W_OK)
|
assert os.access("/srv/repo", os.W_OK)
|
||||||
|
|
||||||
# We should be able to import the package in environment.yml
|
|
||||||
import numpy
|
|
|
@ -1,3 +0,0 @@
|
||||||
dependencies:
|
|
||||||
- r-base=4.2
|
|
||||||
- r-ggplot2
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
jupyter serverextension list 2>&1 | grep jupyter_server_proxy
|
|
||||||
jupyter nbextension list 2>&1 | grep jupyter_server_proxy
|
|
||||||
R -e "library('ggplot2')"
|
|
||||||
# Fail if version is not 4.2
|
|
||||||
R -e 'if (!(version$major == "4" && as.double(version$minor) >= 2 && as.double(version$minor) < 3)) quit("yes", 1)'
|
|
|
@ -1,8 +0,0 @@
|
||||||
Python - Custom Repository Location
|
|
||||||
-----------------------------------
|
|
||||||
|
|
||||||
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}
|
|
|
@ -1,2 +0,0 @@
|
||||||
dependencies:
|
|
||||||
- numpy
|
|
|
@ -1,13 +0,0 @@
|
||||||
Conda - Mixed Requirements
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
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
|
|
|
@ -1,10 +0,0 @@
|
||||||
Conda Environment and Python 2
|
|
||||||
------------------------------
|
|
||||||
|
|
||||||
``environment.yml`` is the standard method for defining environments with the
|
|
||||||
Anaconda (conda) distribution. Conda environment files may allow for more
|
|
||||||
complex builds and dependencies than are possible with a single
|
|
||||||
``requirements.txt`` file.
|
|
||||||
|
|
||||||
This example shows how to define a Python 2 environment with Anaconda. You can
|
|
||||||
define any version of Python that Anaconda supports.
|
|
|
@ -1,7 +0,0 @@
|
||||||
Conda Environment
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
``environment.yml`` is the standard method for defining environments with the
|
|
||||||
Anaconda (conda) distribution. Conda environment files may allow for more
|
|
||||||
complex builds and dependencies than are possible with a single
|
|
||||||
``requirements.txt`` file.
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
pytest -v ./verify.py
|
|
Ładowanie…
Reference in New Issue