Skip to content

Commit

Permalink
Resolve Julia environment before test session & fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Technici4n committed Nov 6, 2024
1 parent da707c6 commit f762094
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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}"
""",
)

Expand Down Expand Up @@ -123,4 +129,6 @@ def _submit_and_await_success(*args, **kwargs):

assert result.exit_status == 0

return result

return _submit_and_await_success

0 comments on commit f762094

Please sign in to comment.