diff --git a/tests/conftest.py b/tests/conftest.py index d761cde..27337d2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,25 +1,31 @@ import logging +import os import pytest +pytest_plugins = 'aiida.manage.tests.pytest_fixtures' + _LOGGER = logging.getLogger(__name__) +_julia_project_path = os.path.join(__file__, "..", "julia_environment") + + +def pytest_sessionstart(): + """Instantiates the test Julia environment before any test runs.""" + import subprocess + + subprocess.run(['julia', f'--project={_julia_project_path}', '-e', 'using Pkg; Pkg.resolve();'], check=True) -pytest_plugins = 'aiida.manage.tests.pytest_fixtures' @pytest.fixture def get_dftk_code(aiida_local_code_factory): """Return an ``InstalledCode`` instance configured to run DFTK calculations on localhost.""" def _get_code(): - import os - - project_path = os.path.join(__file__, "..", "julia_environment") - return aiida_local_code_factory( 'dftk', 'julia', label='dftk', prepend_text=f"""\ - export JULIA_PROJECT="{project_path}" + export JULIA_PROJECT="{_julia_project_path}" """, ) @@ -123,4 +129,6 @@ def _submit_and_await_success(*args, **kwargs): assert result.exit_status == 0 + return result + return _submit_and_await_success