aiidateam / aiida-testing

A pytest plugin to simplify testing of AiiDA plugins.
MIT License
5 stars 6 forks source link

mock-code: Allow code paths to be relative to config file location #51

Closed janssenhenning closed 2 years ago

janssenhenning commented 2 years ago

In aiida-fleur we would like to place the executables to generate mock code test data relative to the location of the .aiida-testing-config.yml. Currently this is only possible with some hacks (See https://github.com/JuDFTteam/aiida-fleur/blob/develop/.github/workflows/ci.yml#L136 for an example) Here the paths are modified in the CI to be absolute

sed -i "s/\./${GITHUB_WORKSPACE//\//\\/}\/tests/g" .aiida-testing-config.yml
./run_all_cov.sh --local-exe-hdf5

We usually don't add compiled fleur executables to a global bin folder, since there are multiple executables with different configurations on the same machine very often.

greschd commented 2 years ago

I don't see a downside to this, but won't have the time to implement it myself. Making the path absolute can probably happen after this code block

https://github.com/aiidateam/aiida-testing/blob/0d104fbad481c6dd2e5a0725e65dc2208fb8058b/aiida_testing/mock_code/_fixtures.py#L170-L174

For the config file path, I think it makes sense to add that to the config as a "special" key in Config.from_file, making sure to exclude it in Config.to_file.

Tagging @ltalirz for comment.

ltalirz commented 2 years ago

Also no objections from my side.

I actually had the need to store also a prepend_text per code (see https://github.com/ltalirz/aiida-testing/tree/add-prepend-text), i.e. I needed to allow for several fields to be stored per code in the config file. Anyhow, this is not needed for this feature.