diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95302b35..e739255d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,8 @@ on: - main pull_request: +env: + FORCE_COLOR: 1 # https://docs.github.com/en/actions/using-jobs/using-concurrency concurrency: @@ -23,7 +25,8 @@ jobs: strategy: matrix: browser: [Chrome, Firefox] - aiida-core-version: [2.1.2, 2.4.3] # test on the latest and the oldest supported version + # test on the latest and the oldest supported version + aiida-core-version: [2.1.2, 2.5.1] fail-fast: false runs-on: ubuntu-latest @@ -84,7 +87,7 @@ jobs: matrix: python-version: ['3.9', '3.10'] # Test on the latest and oldest supported version - aiida-core-version: [2.2.2, 2.4.3] + aiida-core-version: [2.2.2, 2.5.1] fail-fast: false runs-on: ubuntu-latest diff --git a/aiidalab_widgets_base/elns.py b/aiidalab_widgets_base/elns.py index 08c34f7d..752e4dad 100644 --- a/aiidalab_widgets_base/elns.py +++ b/aiidalab_widgets_base/elns.py @@ -124,9 +124,8 @@ def _observe_node(self, _=None): if self.node is None or self.eln is None: return - if "eln" in self.node.extras: - info = self.node.extras["eln"] - else: + info = self.node.base.extras.get("eln", {}) + if not info: try: q = orm.QueryBuilder().append( orm.Node, diff --git a/aiidalab_widgets_base/export.py b/aiidalab_widgets_base/export.py index 0e12a2fd..753a15a0 100644 --- a/aiidalab_widgets_base/export.py +++ b/aiidalab_widgets_base/export.py @@ -11,7 +11,7 @@ class ExportButtonWidget(ipw.Button): def __init__(self, process, **kwargs): self.process = process if "description" not in kwargs: - kwargs["description"] = f"Export workflow ({self.process.id})" + kwargs["description"] = f"Export workflow ({self.process.pk})" if "layout" not in kwargs: kwargs["layout"] = {} kwargs["layout"]["width"] = "initial" @@ -28,7 +28,7 @@ def export_aiida_subgraph(self, change=None): # pylint: disable=unused-argument fname = os.path.join(tempfile.mkdtemp(), "export.aiida") subprocess.call( - ["verdi", "archive", "create", fname, "-N", str(self.process.id)] + ["verdi", "archive", "create", fname, "-N", str(self.process.pk)] ) with open(fname, "rb") as fobj: b64 = base64.b64encode(fobj.read()) @@ -41,6 +41,6 @@ def export_aiida_subgraph(self, change=None): # pylint: disable=unused-argument document.body.appendChild(link); link.click(); document.body.removeChild(link); - """.format(payload=payload, filename=f"export_{self.process.id}.aiida") + """.format(payload=payload, filename=f"export_{self.process.pk}.aiida") ) display(javas) diff --git a/aiidalab_widgets_base/process.py b/aiidalab_widgets_base/process.py index 69ded2dd..e5a77028 100644 --- a/aiidalab_widgets_base/process.py +++ b/aiidalab_widgets_base/process.py @@ -249,7 +249,7 @@ def show_selected_output(self, change=None): clear_output() if change["new"]: selected_output = self.process.outputs[change["new"]] - self.info.value = f"PK: {selected_output.id}" + self.info.value = f"PK: {selected_output.pk}" display(viewer(selected_output)) @@ -537,7 +537,7 @@ def __init__(self, title="Running Job Output", **kwargs): self.title = title self.selection = ipw.Dropdown( description="Select calculation:", - options=tuple((p.id, p) for p in get_running_calcs(self.process)), + options=tuple((p.pk, p) for p in get_running_calcs(self.process)), style={"description_width": "initial"}, ) self.output = CalcJobOutputWidget() @@ -551,7 +551,7 @@ def update(self): with self.hold_trait_notifications(): old_label = self.selection.label self.selection.options = tuple( - (str(p.id), p) for p in get_running_calcs(self.process) + (str(p.pk), p) for p in get_running_calcs(self.process) ) # If the selection remains the same. if old_label in self.selection.options: diff --git a/pyproject.toml b/pyproject.toml index 3126edfc..589f978e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,8 +8,12 @@ build-backend = "setuptools.build_meta" [tool.pytest.ini_options] filterwarnings = [ 'error', + # 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', 'ignore::DeprecationWarning:bokeh.core.property.primitive', 'ignore:Creating AiiDA configuration:UserWarning:aiida', + 'ignore:The `Code` class:aiida.common.warnings.AiidaDeprecationWarning:', 'ignore:crystal system:UserWarning:ase.io.cif', 'ignore::DeprecationWarning:ase.atoms', # TODO: This comes from a transitive dependency of ipyoptimade @@ -20,10 +24,7 @@ filterwarnings = [ # For some reason we get this error, see # https://github.com/aiidalab/aiidalab-widgets-base/issues/551 'ignore:Exception ignored in:pytest.PytestUnraisableExceptionWarning:_pytest', - 'ignore::DeprecationWarning:pytest_html', 'ignore::DeprecationWarning:jupyter_client', - 'ignore::DeprecationWarning:selenium', - 'ignore::DeprecationWarning:pytest_selenium', ] [tool.ruff] diff --git a/setup.cfg b/setup.cfg index 57bb33c2..0660941a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -43,19 +43,15 @@ zip_safe = False [options.extras_require] dev = - bumpver~=2023.1129 + bumpver>=2023.1129 pgtest~=1.3 - pre-commit~=3.5 - # NOTE: pytest-selenium currently incompatible with pytest>=7.2 - # Maybe could be made to work by installing 'py' dependency, see: - # https://docs.pytest.org/en/7.4.x/changelog.html#pytest-7-2-0-2022-10-23 - pytest~=7.1.0 - pytest-cov~=4.0 - pytest-docker~=2.0 - pytest-selenium~=4.0 + pre-commit>=3.5 + pytest~=8.2.0 + pytest-cov~=5.0 + pytest-docker~=3.0 + pytest-selenium~=4.1 pytest-timeout~=2.2 - selenium~=4.7.0 - webdriver-manager~=3.8 + selenium==4.20.0 optimade = ipyoptimade~=0.1 smiles = diff --git a/tests/conftest.py b/tests/conftest.py index c8d3dc6b..4a81ecdd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,15 +14,7 @@ @pytest.fixture -def fixture_localhost(aiida_localhost): - """Return a localhost `Computer`.""" - localhost = aiida_localhost - localhost.set_default_mpiprocs_per_machine(1) - return localhost - - -@pytest.fixture -def generate_calc_job_node(fixture_localhost): +def generate_calc_job_node(aiida_localhost): """Fixture to generate a mock `CalcJobNode` for testing parsers.""" def flatten_inputs(inputs, prefix=""): @@ -60,7 +52,7 @@ def _generate_calc_job_node( from plumpy import ProcessState if computer is None: - computer = fixture_localhost + computer = aiida_localhost filepath_folder = None diff --git a/tests/test_computational_resources.py b/tests/test_computational_resources.py index 4b2fb8b4..db0caa3b 100644 --- a/tests/test_computational_resources.py +++ b/tests/test_computational_resources.py @@ -287,7 +287,7 @@ def test_aiida_code_setup(aiida_localhost): assert code.label == "bash" assert code.description == "Bash interpreter" assert str(code.filepath_executable) == "/bin/bash" - assert code.get_input_plugin_name() == "core.arithmetic.add" + assert code.default_calc_job_plugin == "core.arithmetic.add" # Reset the widget and check that a few attributes are reset. widget.code_setup = {} diff --git a/tests/test_export.py b/tests/test_export.py index 1f0bd837..b193b3b2 100644 --- a/tests/test_export.py +++ b/tests/test_export.py @@ -9,7 +9,7 @@ def test_export_button_widget(multiply_add_completed_workchain, monkeypatch, tmp process = multiply_add_completed_workchain button = export.ExportButtonWidget(process) - assert button.description == f"Export workflow ({process.id})" + assert button.description == f"Export workflow ({process.pk})" # Test the export button. monkeypatch the `mkdtemp` function to return a # temporary directory in the `tmp_path` fixture to store the export file.