From 48cac20e7b36e00230ed4f88d836d6ecac8d8cb4 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Wed, 21 Feb 2024 12:55:35 +0000 Subject: [PATCH] Add test to latest and oldest supported aiida-core --- .github/workflows/ci.yml | 6 +++--- tests_notebooks/conftest.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc5ec9c17..a223d80a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,9 +41,9 @@ jobs: strategy: matrix: - tag: [latest] browser: [Chrome, Firefox] python-version: ['3.10'] + aiida-core-version: [2.1.2, 2.4.3] # test on the latest and the oldest supported version fail-fast: false runs-on: ubuntu-latest @@ -91,13 +91,13 @@ jobs: - name: Run pytest run: pytest -v --driver ${{ matrix.browser }} tests_notebooks env: - TAG: ${{ matrix.tag }} + TAG: ${{ matrix.aiida-core-version }} - name: Upload screenshots as artifacts if: always() uses: actions/upload-artifact@v3 with: - name: Screenshots-${{ matrix.tag }}-${{ matrix.browser }} + name: Screenshots-${{ matrix.aiida-core-version }}-${{ matrix.browser }} path: screenshots/ if-no-files-found: error diff --git a/tests_notebooks/conftest.py b/tests_notebooks/conftest.py index 3992340d0..bb658f57a 100644 --- a/tests_notebooks/conftest.py +++ b/tests_notebooks/conftest.py @@ -60,9 +60,25 @@ def notebook_service(docker_ip, docker_services, aiidalab_exec): # make it writeable for jovyan user, needed for `pip install` aiidalab_exec("chmod -R a+rw /home/jovyan/apps/aiidalab-widgets-base", user="root") + # The aiida-core version is pinned in the requirements.txt file only after + # we release the docker stack with aiida-core v2.4.0 in: + # https://github.com/aiidalab/aiidalab-docker-stack/commit/dfa65151017362fefeb56d97fed3c1b8f25537c5 + # There is a possibility that aiida-core version will be overwritten by the installation of AWB. + # TODO: We can move this before/after version check after the lowest supported aiida-core version is 2.4.0. + + # Get the aiida-core version before installing AWB + output = aiidalab_exec("verdi --version").decode("utf-8").strip() + before_version = output.split(" ")[-1] + # Install AWB with extra dependencies for SmilesWidget aiidalab_exec("pip install --no-cache-dir .[smiles,optimade]") + # Get the aiida-core version before installing AWB + output = aiidalab_exec("verdi --version").decode("utf-8").strip() + after_version = output.split(" ")[-1] + + assert before_version != after_version + # `port_for` takes a container port and returns the corresponding host port port = docker_services.port_for("aiidalab", 8888) url = f"http://{docker_ip}:{port}"