aiidateam / aiida-testing

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

suggest method for versioning of mocked codes #32

Open ltalirz opened 4 years ago

ltalirz commented 4 years ago

The usual approach to versioning of codes in AiiDA is, at the moment, to encode the version both in the label and in the description of the code.

It seems to me, the documentation of mock_code should include an example of a versioned code (besides diff). The easiest thing would simply be to follow this pattern - it might lead some people to point a code "cp2k-5.1" to an actual cp2k-6.1 binary on their system (because that's what they happen to have installed) but I still think it's still better than to have no versioning. This is necessary for tests against multiple versions of a code, and I think we should therefore already start with good habits.

Small detail: Currently, the mock-code factory only allows setting the label, not the description of a code. Also, both label and description can be set directly via the constructor rather than like this https://github.com/aiidateam/aiida-testing/blob/9d88c9ef2160a742c2da08b490fa2d2f9f198225/aiida_testing/mock_code/_fixtures.py#L63 One could either make explicit label/description arguments or just forward remaining **kwargs to the Code constructor.

P.S. Currently, the kwarg for the entry point is called entry_point in the factory and input_plugin_name in the code. One could decide to harmonize this.

greschd commented 4 years ago

Hmm, since this is already explained in the AiiDA docs, do you think it's really necessary to document again here? I mean, there is in principle nothing special about a versioned code, is there?

Small detail: Currently, the mock-code factory only allows setting the label, not the description of a code.

Sure, no harm in adding the description also.

P.S. Currently, the kwarg for the entry point is called entry_point in the factory and input_plugin_name in the code. One could decide to harmonize this.

Hmm, this is taken from the aiida_local_code_factory (here) - not sure which one it is more convenient to be consistent with.