Skip to content
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

Tests: Make daemon fixtures available to plugin packages #5701

Merged

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Oct 18, 2022

The conftest.py provides useful fixtures for tests that require a started or stopped daemon client:

  • started_daemon_client: make sure daemon is running and return client
  • stopped_daemon_client: make sure daemon is stopped and return client
  • submit_and_await: submit a process or builder and wait for it to reach a particular process state.

These fixtures are not just useful for tests of aiida-core but also for plugin packages. Therefore they are moved to the module aiida.manage.tests.pytest_fixtures such that they can be easily imported into the conftest.py of a plugin package.

@sphuber sphuber requested a review from unkcpz October 18, 2022 09:16
@sphuber sphuber force-pushed the fix/daemon-fixtures-accessible-plugins branch 2 times, most recently from 1874ca2 to da9a3cc Compare October 18, 2022 11:01
Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sphuber thanks! All good. Very useful and brilliant feature. Just one minor request, might be worth to add a short doc of the fixture to https://aiida.readthedocs.io/projects/aiida-core/en/latest/topics/plugins.html#plugin-test-fixtures

@sphuber sphuber force-pushed the fix/daemon-fixtures-accessible-plugins branch from da9a3cc to e83b41e Compare October 18, 2022 20:58
@sphuber sphuber requested a review from unkcpz October 18, 2022 20:58
@sphuber
Copy link
Contributor Author

sphuber commented Oct 18, 2022

@unkcpz I updated the test fixture docs and added the new fixtures.

@sphuber sphuber force-pushed the fix/daemon-fixtures-accessible-plugins branch from e83b41e to d2f09e8 Compare October 19, 2022 07:04
The `conftest.py` provides useful fixtures for tests that require a
started or stopped daemon client:

 * `started_daemon_client`: make sure daemon is running and return client
 * `stopped_daemon_client`: make sure daemon is stopped and return client
 * `submit_and_await`: submit a process or builder and wait for it to
   reach a particular process state.

These fixtures are not just useful for tests of `aiida-core` but also for
plugin packages. Therefore they are moved to the module
`aiida.manage.tests.pytest_fixtures` such that they can be easily imported
into the `conftest.py` of a plugin package.
@sphuber sphuber force-pushed the fix/daemon-fixtures-accessible-plugins branch from d2f09e8 to 5329b43 Compare October 19, 2022 09:21
Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sphuber, the code looks good and I think the documentation is clear for me. But I am not good at review the documentation 😆, maybe someone else want to have a look too. I approve it anyway.

@sphuber sphuber merged commit c2934b2 into aiidateam:main Oct 19, 2022
@sphuber sphuber deleted the fix/daemon-fixtures-accessible-plugins branch October 19, 2022 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants