-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Plugin fixtures #716
WIP: Plugin fixtures #716
Conversation
5ab3fe3
to
962d818
Compare
Also of interest to @broeder-j and all other plugin developers |
Very nice! Could you perhaps also add one example of how to use it? (or point me to where it is used) |
9637f37
to
013d089
Compare
updated the description with examples |
@DropD Sorry if I am overlooking it - but where did you update the description? |
The description of the PR |
Examples are now also in the docstrings |
Adding WIP status, because although |
Thanks, indeed I overlooked that ;) For example, should users simply inherit from |
7ab6e35
to
182338a
Compare
fb91b94
to
182338a
Compare
182338a
to
f6b0ba7
Compare
Let me know, when to go through it again! |
aiida/utils/fixtures.py
Outdated
BACKEND = <load from env variable etc> | ||
BACKEND = os.environ.get('TEST_BACKEND') | ||
# load the backend to be tested from the environment variable | ||
# proceed the test command with TEST_BACKEND='django' | 'sqlalchemy' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simply prepend the test command by TEST_BACKEND='django' or TEST_BACKEND='sqlalchemy'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
Now we need to add a test to the aiida plugin template!
Add fixtures that plugins can use in their tests.
The FixtureManager class can set up a complete separate, temporary aiida environment for the duration of a test.
A simple use example is:
Alternatively the contextmanager may be used:
aiida.utils.fixtures.PluginTestCase
.pytest
is to be found in github.com/DropD/aiida-vasp inaiida_vasp.calcs.tests.test_base