Hi Otto,
You are in luck, as I recently added a pytest fixture for just this
purpose.
You can find the documentation online:
https://aiida.readthedocs.io/projects/aiida-core/en/latest/topics/plugins.html#topics-plugins-testfixtures-entry-points
If you are running your tests with `pytest` (which I highly
recommend you do) you could run a test like the following:
def test_parser(entry_points):
"""Test a custom ``Parser`` implementation."""
from aiida.parsers import Parser
from aiida.plugins import ParserFactory
class CustomParser(Parser):
"""Parser implementation."""
entry_points.add(CustomParser, 'custom.parser')
assert ParserFactory('custom.parser', CustomParser)
In this example, I define a custom implementation of the `Parser`
class and "register" it with the `custom.parser` entry point through
the `entry_points` fixture.
By doing so, AiiDA will be aware of this plugin, for the duration of
the test, as if you would have installed it through an actual
package.
Note that the fixture was added in aiida-core v2.1.0 so you need at
least that version.
Hope that helps,
Sebastiaan