From abe2cc859841712378bd0d9f5a0253afaf600e84 Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 8 Feb 2023 13:51:04 +0100 Subject: [PATCH] import downgrade test rather than building old xeus-cling, which requires a downgrade of Python from 3.10 to 3.9, which is _not_ supported, run the build with a 3.9 pin. This still results in patch-level downgrade of Python, major downgrade of openssl, etc. --- tests/conda/downgrade/environment.yml | 11 +++++++++ tests/conda/downgrade/verify | 30 +++++++++++++++++++++++++ tests/external/reproductions.repos.yaml | 6 ----- 3 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 tests/conda/downgrade/environment.yml create mode 100755 tests/conda/downgrade/verify diff --git a/tests/conda/downgrade/environment.yml b/tests/conda/downgrade/environment.yml new file mode 100644 index 00000000..319f8d5d --- /dev/null +++ b/tests/conda/downgrade/environment.yml @@ -0,0 +1,11 @@ +# originally xeus-cling@0.6.0 +# added python=3.9 pin because implicit downgrade of Python from 3.10 to 3.9 isn't allowed +name: xeus-cling +channels: + - conda-forge +dependencies: + - python=3.9 + - xeus-cling=0.6.0 + - xtensor=0.20.8 + - xtensor-blas=0.16.1 + - notebook diff --git a/tests/conda/downgrade/verify b/tests/conda/downgrade/verify new file mode 100755 index 00000000..07b40940 --- /dev/null +++ b/tests/conda/downgrade/verify @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +import json +import pprint +from subprocess import check_output + + +def json_sh(cmd): + """Run a command that produces JSON on stdout and return the parsed result""" + buf = check_output(cmd) + return json.loads(buf.decode("utf8", "replace")) + + +conda_pkg_list = json_sh(["conda", "list", "--json"]) +pprint.pprint(conda_pkg_list) +# make it a dict +pkgs = {pkg["name"]: pkg for pkg in conda_pkg_list} + +# base env resolved +assert pkgs["python"]["version"].startswith("3.9"), pkgs["python"] +assert "xeus-cling" in pkgs +assert pkgs["xeus-cling"]["version"] == "0.6.0" + +# verify downgrade +# this may be brittle, but it's unlikely any of these old versions +# of packages will be rebuilt +# xeus-cling 0.6.0 pins xeus 0.20, which pins openssl 1.1.1, +# which in turn downgrades Python from >=3.9.16 to 3.9.6 + +assert pkgs["openssl"]["version"].startswith("1.1.1"), pkgs["openssl"]["version"] +assert pkgs["python"]["version"] == "3.9.6", pkgs["python"]["version"] diff --git a/tests/external/reproductions.repos.yaml b/tests/external/reproductions.repos.yaml index 74f1085c..55509a01 100644 --- a/tests/external/reproductions.repos.yaml +++ b/tests/external/reproductions.repos.yaml @@ -24,12 +24,6 @@ url: https://github.com/binder-examples/requirements ref: python-3.7 verify: python -c 'import matplotlib' -# Test that custom channels and downgrades don't -# get blocked by pinning -- name: Xeus-Cling - url: https://github.com/QuantStack/xeus-cling - ref: 0.6.0 - verify: jupyter kernelspec list # Zenodo record of https://github.com/binder-examples/requirements - name: 10.5281/zenodo.3242074 url: 10.5281/zenodo.3242074