Skip to content

Commit

Permalink
Test with aiida-core=2.6.1 and python 3.11 (aiidalab#760)
Browse files Browse the repository at this point in the history
* Update links in README
* Collect coverage only for aiida-core=2.3 runs
* Report pytest timings
* Filter warnings as in AWB
* Bump pytest and pytest-cov
* bump uv version
* Bump uv and ruff versions
  • Loading branch information
danielhollas authored Aug 21, 2024
1 parent 3ce7d18 commit b9cea17
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 27 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ concurrency:

env:
FORCE_COLOR: 1
UV_VERSION: 0.3.0

jobs:

test-package:

strategy:
matrix:
tag: [latest]
python-version: ['3.9', '3.10']
aiida-core-version: [2.3, 2.5]
python-version: ['3.9', '3.11']
aiida-core-version: ['2.3', '2.6']
fail-fast: false

runs-on: ubuntu-latest
Expand All @@ -45,15 +45,16 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install uv
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.2.13/uv-installer.sh | sh
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${{ env.UV_VERSION }}/uv-installer.sh | sh

- name: Install package
run: uv pip install --system -e .[dev] aiida-core==${{ matrix.aiida-core-version }}

- name: Run pytest
run: pytest -v tests --cov=aiidalab_qe
env:
TAG: ${{ matrix.tag }}
# Only collect code coverage with aiida-core=2.3, to speed up tests
# with higher aiida versions that for some reason run slower, see:
# https://github.com/aiidalab/aiidalab-qe/issues/766
run: pytest -v tests ${{ matrix.aiida-core-version == '2.3' && '--cov=aiidalab_qe' || '' }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repos:
- id: nbstripout

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
rev: v0.6.1
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ Additional notes:
## Acknowledgements
We acknowledge support from:
* the European Union\'s Horizon 2020 research and innovation programme (Grant No. 957189, [project BIG-MAP](https://www.big-map.eu)).
* the [MARVEL National Centre for Competency in Research](<http://nccr-marvel.ch>) funded by the [Swiss National Science Foundation](<http://www.snf.ch/en>).
* the [MARVEL National Centre for Competency in Research](https://nccr-marvel.ch/) funded by the [Swiss National Science Foundation](https://www.snf.ch/en).
* the MARKETPLACE project funded by [Horizon 2020](https://ec.europa.eu/programmes/horizon2020/) under the H2020-NMBP-25-2017 call (Grant No. 760173).
* the [MaX European Centre of Excellence](<http://www.max-centre.eu/>) funded by the Horizon 2020 EINFRA-5 program (Grant No. 676598).
* the [MaX European Centre of Excellence](https://www.max-centre.eu/) funded by the Horizon 2020 EINFRA-5 program (Grant No. 676598).

<div style="text-align:left">
<img src="miscellaneous/logos/MARVEL.png" alt="MARVEL" height="75px">
Expand Down
12 changes: 11 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,22 @@ requires = [
]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
addopts = '--strict-config --strict-markers --durations=30 --durations-min=1 -ra'
filterwarnings = [
'ignore:Object of type .* not in session, .* operation along .* will not proceed:',
'ignore:Creating AiiDA configuration:UserWarning:',
'ignore:metadata.*traitlets.traitlets.Unicode object:DeprecationWarning:',
# For some reason we get this error, see
# https://github.com/aiidalab/aiidalab-widgets-base/issues/551
'ignore:Exception ignored in:pytest.PytestUnraisableExceptionWarning:_pytest',
]

[tool.ruff]
line-length = 88
show-fixes = true
output-format = "full"
target-version = "py39"
extend-include = ["*.ipynb"]

[tool.ruff.lint]
ignore = ["E501", "E402", "TRY003", "RUF012", "N806"]
Expand Down
4 changes: 2 additions & 2 deletions qe.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
"from datetime import datetime\n",
"\n",
"import ipywidgets as ipw\n",
"from aiidalab_qe.app import App, static\n",
"from aiidalab_qe.version import __version__\n",
"from importlib_resources import files\n",
"from IPython.display import display\n",
"from jinja2 import Environment\n",
"\n",
"from aiidalab_qe.app import App, static\n",
"from aiidalab_qe.version import __version__\n",
"from aiidalab_widgets_base.bug_report import (\n",
" install_create_github_issue_exception_handler,\n",
")"
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ where = src
dev =
bumpver~=2023.1124
pre-commit~=3.2
pytest~=6.2
pytest~=7.4
pytest-regressions~=2.2
pgtest==1.3.1
pytest-cov~=4.0
pytest-cov~=5.0

[options.package_data]
aiidalab_qe.app.parameters = qeapp.yaml
Expand Down
3 changes: 1 addition & 2 deletions tests/configuration/test_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ def test_advanced_tot_charge_settings():

def test_advanced_kpoints_mesh():
"""Test Mesh Grid HTML widget."""
from aiidalab_qe.app.configuration.advanced import AdvancedSettings

from aiida import orm
from aiidalab_qe.app.configuration.advanced import AdvancedSettings

w = AdvancedSettings()

Expand Down
5 changes: 2 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import tempfile

import pytest
from aiidalab_qe.setup.pseudos import SSSP_VERSION

from aiida import orm
from aiidalab_qe.setup.pseudos import SSSP_VERSION

pytest_plugins = ["aiida.manage.tests.pytest_fixtures"]

Expand Down Expand Up @@ -630,12 +630,11 @@ def _generate_qeapp_workchain(
):
from copy import deepcopy

from aiida.orm.utils.serialize import serialize
from aiidalab_qe.app.configuration import ConfigureQeAppWorkChainStep
from aiidalab_qe.app.submission import SubmitQeAppWorkChainStep
from aiidalab_qe.workflows import QeAppWorkChain

from aiida.orm.utils.serialize import serialize

# Step 1: select structure from example
s1 = app.structure_step
if structure is None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import time

import aiidalab_qe.__main__ as cli
from click.testing import CliRunner, Result

import aiida
import aiidalab_qe.__main__ as cli

# To learn more about testing click applications, see: https://click.palletsprojects.com/en/8.1.x/testing/

Expand Down
1 change: 1 addition & 0 deletions tests/test_plugins_bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@pytest.mark.usefixtures("sssp")
def test_result(generate_qeapp_workchain):
import plotly.graph_objects as go

from aiidalab_qe.common.bandpdoswidget import BandPdosWidget
from aiidalab_qe.plugins.bands.result import Result

Expand Down
4 changes: 2 additions & 2 deletions tests/test_plugins_electronic_structure.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
def test_electronic_structure(generate_qeapp_workchain):
"""Test the electronic structure tab."""
import plotly.graph_objects as go

from aiida import engine
from aiidalab_qe.app.result.workchain_viewer import WorkChainViewer
from aiidalab_qe.common.bandpdoswidget import BandPdosWidget
from aiidalab_qe.plugins.electronic_structure.result import Result

from aiida import engine

wkchain = generate_qeapp_workchain()
wkchain.node.set_exit_status(0)
wkchain.node.set_process_state(engine.ProcessState.FINISHED)
Expand Down
1 change: 1 addition & 0 deletions tests/test_plugins_pdos.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@pytest.mark.usefixtures("sssp")
def test_result(generate_qeapp_workchain):
import plotly.graph_objects as go

from aiidalab_qe.common.bandpdoswidget import BandPdosWidget
from aiidalab_qe.plugins.pdos.result import Result

Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugins_xps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
def test_settings():
"""Test the settings of the xps app."""

from aiidalab_qe.app.configuration import ConfigureQeAppWorkChainStep
from ase.build import molecule

from aiida.orm import StructureData
from aiidalab_qe.app.configuration import ConfigureQeAppWorkChainStep

configure_step = ConfigureQeAppWorkChainStep()
# set the input structure
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pseudo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import pytest

from aiida import orm
from aiidalab_qe.setup.pseudos import (
PSEUDODOJO_VERSION,
SSSP_VERSION,
Expand All @@ -7,8 +9,6 @@
pseudos_to_install,
)

from aiida import orm


def test_setup_pseudos_cmd(tmp_path):
"""Test _construct_cmd function in setup.pseudos"""
Expand Down
3 changes: 2 additions & 1 deletion tests/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ def test_summary_report_advanced_settings(data_regression, generate_qeapp_workch

def test_summary_view(generate_qeapp_workchain):
"""Test the report html can be properly generated."""
from aiidalab_qe.app.result.summary_viewer import SummaryView
from bs4 import BeautifulSoup

from aiidalab_qe.app.result.summary_viewer import SummaryView

wkchain = generate_qeapp_workchain()
viewer = SummaryView(wkchain.node)
report_html = viewer.report_html
Expand Down

0 comments on commit b9cea17

Please sign in to comment.