Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test python 3.11 image #610

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'

- name: Install uv
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${UV_VERSION}/uv-installer.sh | sh
Expand All @@ -58,19 +58,23 @@ jobs:
# The Firefox and its engine geckodrive need do be installed manually to run
# selenium tests.
- name: Install Firefox
if: matrix.browser == 'Firefox'
uses: browser-actions/setup-firefox@latest
with:
firefox-version: '96.0'
firefox-version: '124.0'

- name: Firefox version
if: matrix.browser == 'Firefox'
run: firefox --version

- name: Install geckodriver
run: |
wget -c https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
tar xf geckodriver-v0.30.0-linux64.tar.gz -C /usr/local/bin
if: matrix.browser == 'Firefox'
run: |
wget -c https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz
tar xf geckodriver-v0.34.0-linux64.tar.gz -C /usr/local/bin

- name: Run pytest
run: pytest -v --driver ${{ matrix.browser }} tests_notebooks
run: pytest -v --driver ${{ matrix.browser }} tests_notebooks/
env:
TAG: aiida-${{ matrix.aiida-core-version }}

Expand All @@ -86,7 +90,7 @@ jobs:

strategy:
matrix:
python-version: ['3.9', '3.10']
python-version: ['3.9', '3.11']
# Test on the latest and oldest supported version
aiida-core-version: [2.2.2, 2.5.1]
fail-fast: false
Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ build-backend = "setuptools.build_meta"
[tool.pytest.ini_options]
filterwarnings = [
'error',
# The following deprecation warnings come from Python 3.12 stdlib modules
"ignore:datetime.datetime.:DeprecationWarning:",
# This one is coming from plumpy
"ignore:There is no current event loop:DeprecationWarning:",
# This deprecation warning coming from sqlite3 module might go away if we update bokeh
"ignore:The default datetime adapter is deprecated as of Python 3.12; see the sqlite3 documentation for suggested replacement recipes:DeprecationWarning:",
# This is needed since SQLAlchemy 2.0, see
# https://github.com/aiidalab/aiidalab-widgets-base/issues/605
'ignore:Object of type .* not in session, .* operation along .* will not proceed:sqlalchemy.exc.SAWarning',
Expand All @@ -25,6 +31,9 @@ filterwarnings = [
# https://github.com/aiidalab/aiidalab-widgets-base/issues/551
'ignore:Exception ignored in:pytest.PytestUnraisableExceptionWarning:_pytest',
'ignore::DeprecationWarning:jupyter_client',
# This warning is coming from circus (aiida-core dependency):
# https://github.com/circus-tent/circus/issues/1215
"ignore:'pipes' is deprecated and slated for removal in Python 3.13:DeprecationWarning:",
]

[tool.ruff]
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ eln =
aiidalab-eln>=0.1.2,~=0.1
smiles =
rdkit>=2021.09.2
scikit-learn~=1.0.0
scikit-learn~=1.1
docs =
sphinx~=7.3
sphinx-design~=0.5
Expand Down
15 changes: 9 additions & 6 deletions tests_notebooks/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import time
from pathlib import Path
from urllib.parse import urljoin

Expand Down Expand Up @@ -48,7 +49,8 @@ def execute(command, user=None, **kwargs):
else:
command = f"exec --workdir {workdir} -T aiidalab {command}"

return docker_compose.execute(command, **kwargs)
out = docker_compose.execute(command, **kwargs)
return out.decode("utf-8").strip()

return execute

Expand All @@ -64,17 +66,17 @@ def notebook_service(docker_ip, docker_services, aiidalab_exec):
# 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.
# TODO: We can remove 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()
output = aiidalab_exec("verdi --version")
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()
output = aiidalab_exec("verdi --version")
after_version = output.split(" ")[-1]

assert (
Expand All @@ -86,7 +88,7 @@ def notebook_service(docker_ip, docker_services, aiidalab_exec):
url = f"http://{docker_ip}:{port}"
token = os.environ["JUPYTER_TOKEN"]
docker_services.wait_until_responsive(
timeout=30.0, pause=0.1, check=lambda: is_responsive(url)
timeout=30.0, pause=0.5, check=lambda: is_responsive(url)
)
return url, token

Expand All @@ -109,9 +111,10 @@ def _selenium_driver(nb_path):

selenium.find_element(By.ID, "ipython-main-app")
selenium.find_element(By.ID, "notebook-container")
WebDriverWait(selenium, 240).until(
WebDriverWait(selenium, timeout=240, poll_frequency=0.5).until(
ec.invisibility_of_element((By.ID, "appmode-busy"))
)
time.sleep(3)

return selenium

Expand Down
2 changes: 1 addition & 1 deletion tests_notebooks/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
# since the dockerhub registry has a rate limit of 100 pulls per 6 hours.
# Images with aiida-core<2.4.0 were not pushed to ghcr.io because of CI issues,
# which were fixed in https://github.com/aiidalab/aiidalab-docker-stack/pull/390
image: aiidalab/full-stack:${TAG:-latest}
image: aiidalab/full-stack:${TAG-latest}
environment:
RMQHOST: messaging
TZ: Europe/Zurich
Expand Down
17 changes: 14 additions & 3 deletions tests_notebooks/test_notebooks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import time

import requests
import selenium.webdriver.support.expected_conditions as ec
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait


def wait_till_not_busy(driver):
WebDriverWait(driver, timeout=500, poll_frequency=1.0).until(
ec.invisibility_of_element((By.ID, "appmode-busy"))
)


def test_notebook_service_available(notebook_service):
Expand All @@ -21,7 +29,7 @@ def test_aiida_datatypes_viewers(selenium_driver, final_screenshot):
driver.set_window_size(1000, 2000)
driver.find_element(By.CLASS_NAME, "widget-label")
driver.find_element(By.XPATH, '//button[text()="Clear selection"]')
time.sleep(5)
wait_till_not_busy(driver)


def test_eln_configure(selenium_driver, final_screenshot):
Expand Down Expand Up @@ -54,6 +62,7 @@ def test_structures_generate_from_smiles(selenium_driver, final_screenshot):
# Generate methane molecule from SMILES
driver.find_element(By.XPATH, "//input[@placeholder='C=C']").send_keys("C")
driver.find_element(By.XPATH, '//button[text()="Generate molecule"]').click()
wait_till_not_busy(driver)
time.sleep(5)

# Select the first atom
Expand All @@ -62,6 +71,7 @@ def test_structures_generate_from_smiles(selenium_driver, final_screenshot):
By.XPATH, "//label[text()='Select atoms:']/following-sibling::input"
).send_keys("1")
driver.find_element(By.XPATH, '//button[text()="Apply selection"]').click()
wait_till_not_busy(driver)
driver.find_element(By.XPATH, "//p[contains(text(),'Id: 1; Symbol: C;')]")


Expand Down Expand Up @@ -95,6 +105,7 @@ def test_structure_from_examples_and_supercell_selection(
driver.find_element(By.XPATH, '//button[text()="Apply selection"]').click()

# Make sure the selection is what we expect
wait_till_not_busy(driver)
driver.find_element(By.XPATH, "//p[contains(text(), 'Selected atoms: 12')]")
driver.find_element(
By.XPATH, "//p[contains(text(), 'Selected unit cell atoms: 6')]"
Expand All @@ -115,7 +126,7 @@ def test_computational_resources_code_setup(
):
"""Test the quicksetup of the code"""
# check the code CP2K is not in code list
output = aiidalab_exec("verdi code list").decode().strip()
output = aiidalab_exec("verdi code list")
assert "cp2k" not in output

driver = selenium_driver("notebooks/computational_resources.ipynb")
Expand Down Expand Up @@ -149,5 +160,5 @@ def test_computational_resources_code_setup(
time.sleep(1.0)

# check the new code cp2k-9.1@daint-mc is in code list
output = aiidalab_exec("verdi code list").decode().strip()
output = aiidalab_exec("verdi code list")
assert "cp2k-9.1@daint-mc" in output
Loading