From 5f6d76764b8f650fb27fbda462b537e8b16e4ec0 Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 15 Feb 2023 12:53:08 +0100 Subject: [PATCH] update test expectations in py35/py36 tests `/usr/bin/env python` is no longer the kernel python --- tests/conda/py35-binder-dir/verify | 21 ++++++++++++++++----- tests/external/reproductions.repos.yaml | 2 +- tests/pipfile/py36/verify | 8 ++++---- tests/venv/py35/verify | 2 +- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/tests/conda/py35-binder-dir/verify b/tests/conda/py35-binder-dir/verify index 8bad344d..dc2d9a60 100755 --- a/tests/conda/py35-binder-dir/verify +++ b/tests/conda/py35-binder-dir/verify @@ -1,17 +1,28 @@ #!/usr/bin/env python +import os import sys -from subprocess import check_output +from subprocess import STDOUT, check_output -assert sys.version_info[:2] == (3, 5), sys.version +assert sys.version_info[:2] == (3, 7), sys.version -out = check_output(["micromamba", "--version"]).decode("utf8").strip() + +def sh(cmd, **kwargs): + return check_output(cmd, **kwargs).decode("utf8").strip() + + +kernel_python = os.path.join(os.environ["KERNEL_PYTHON_PREFIX"], "bin", "python") +out = sh([kernel_python, "--version"], stderr=STDOUT) +v = out.split()[1] +assert v[:3] == "3.5", out + +out = sh(["micromamba", "--version"]) assert out == "1.1.0", out -out = check_output(["mamba", "--version"]).decode("utf8").strip() +out = sh(["mamba", "--version"]) assert ( out == """mamba 1.1.0 conda 4.13.0""" ), out -import numpy +sh([kernel_python, "-c", "import numpy"]) diff --git a/tests/external/reproductions.repos.yaml b/tests/external/reproductions.repos.yaml index 74f1085c..6f9c3459 100644 --- a/tests/external/reproductions.repos.yaml +++ b/tests/external/reproductions.repos.yaml @@ -33,7 +33,7 @@ # Zenodo record of https://github.com/binder-examples/requirements - name: 10.5281/zenodo.3242074 url: 10.5281/zenodo.3242074 - verify: python -c 'import matplotlib' + verify: /srv/conda/envs/kernel/bin/python -c 'import matplotlib' # Test that files in git-lfs are properly cloned - name: LFS url: https://github.com/binderhub-ci-repos/lfs diff --git a/tests/pipfile/py36/verify b/tests/pipfile/py36/verify index f71a6daa..f54d226a 100755 --- a/tests/pipfile/py36/verify +++ b/tests/pipfile/py36/verify @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/srv/conda/envs/kernel/bin/python import sys -import pypi_pkg_test -import there - print(sys.version_info) assert sys.version_info[:2] == (3, 6) + +import pypi_pkg_test # noqa +import there # noqa diff --git a/tests/venv/py35/verify b/tests/venv/py35/verify index 4abec309..6475d4f3 100755 --- a/tests/venv/py35/verify +++ b/tests/venv/py35/verify @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/srv/conda/envs/kernel/bin/python import sys print(sys.version_info)