stfc / aiida-mlip

machine learning interatomic potentials aiida plugin
https://stfc.github.io/aiida-mlip/
BSD 3-Clause "New" or "Revised" License
4 stars 5 forks source link

Update pytest fixtures #166

Open ElliottKasoar opened 2 days ago

ElliottKasoar commented 2 days ago

Currently used fixtures are deprecated, and will be removed with AiiDA version 3, so we should look into using fixtures from aiida.tools.pytest_fixtures.

Most fixtures have a direct correspondence to aiida.manage.tests.pytest_fixtures, but currently doing this seems to result in the default profile not being set when callling verdi run.

This can be fixed along the lines of

def test_example_md(example_path, aiida_profile, janus_code):
    command = ["verdi", "profile", "set-default", f"{aiida_profile.name}"]
    result = subprocess.run(command, capture_output=True, text=True, check=False)

but it ought to be fixable via the fixtures directly.

alinelena commented 2 days ago

just be careful how you split the command, passing it like that can be dangerous if not all things are correctly escaped