Skip to content

Commit

Permalink
Tests: Revert change to fixture_code
Browse files Browse the repository at this point in the history
In commit a68e1e1 the `fixture_code` fixture
was adapted to query for the first `InstalledCode` with the test code label
instead of using `load_code`, as the latter would fail when running the new
parametrized PDOS tests in parallel.

However, running tests in parallel versus the same storage backend can
potentially lead to all sorts of problems. So instead of providing a somewhat
hacky fix for this case, we revert the changes made to `fixture_code` and avoid
running the tests in parallel.
  • Loading branch information
mbercx authored Dec 13, 2023
1 parent 49d503d commit e9ce7a0
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# pylint: disable=redefined-outer-name,too-many-statements,unsubscriptable-object
# pylint: disable=redefined-outer-name,too-many-statements
"""Initialise a text database and profile for pytest."""
from collections.abc import Mapping
import io
Expand Down Expand Up @@ -51,17 +51,14 @@ def fixture_code(fixture_localhost):
"""Return an ``InstalledCode`` instance configured to run calculations of given entry point on localhost."""

def _fixture_code(entry_point_name):
from aiida.orm import InstalledCode, QueryBuilder
from aiida.common import exceptions
from aiida.orm import InstalledCode, load_code

label = f'test.{entry_point_name}'

query = QueryBuilder().append(
InstalledCode,
filters={'label': label},
)
try:
return query.first()[0]
except TypeError:
return load_code(label=label)
except exceptions.NotExistent:
return InstalledCode(
label=label,
computer=fixture_localhost,
Expand Down

0 comments on commit e9ce7a0

Please sign in to comment.