-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add improved more configurable versions of
pytest
fixtures
The `pytest` fixtures are intended to help plugin packages to easily write unit tests. Arguably the most important fixture is the `aiida_profile` fixture which automatically provides a ready-to-go profile. The downside is that it uses the `core.psql_dos` storage backend, which was historically the only available storage. Now there are other storage plugins available. Not only would it be useful to allow a user to easily configure which storage plugin to use for the test profile, it would make sense to change the default from `core.psql_dos` to a storage plugin that doesn't require a PostgreSQL database. Sure, the plugin currently uses `pgtest` to create a test cluster on the fly so the test database is created on the fly and doesn't affect production databases, however, it still does require the PostgreSQL libraries to be installed, or the `pg_ctl` binary won't be found and the fixture fails. The `aiida_profile` fixture now instead uses the `core.sqlite_dos` by default and configures to use no broker, which also means that RabbitMQ is no longer needed. This makes it possible to run the tests by default without any services running, making it much easier to get started running tests on any environment that just has `aiida-core` installed.
- Loading branch information
Showing
55 changed files
with
1,363 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"""Fixtures to simplify writing unit tests for AiiDA with ``pytest``.""" | ||
# AUTO-GENERATED | ||
|
||
# fmt: off | ||
|
||
from .configuration import ( | ||
aiida_config, | ||
aiida_config_factory, | ||
aiida_config_tmp, | ||
aiida_profile, | ||
aiida_profile_clean, | ||
aiida_profile_clean_class, | ||
aiida_profile_factory, | ||
aiida_profile_tmp, | ||
) | ||
from .daemon import daemon_client, started_daemon_client, stopped_daemon_client, submit_and_await | ||
from .entry_points import entry_points | ||
from .globals import aiida_manager | ||
from .orm import ( | ||
aiida_code, | ||
aiida_code_installed, | ||
aiida_computer, | ||
aiida_computer_local, | ||
aiida_computer_ssh, | ||
aiida_localhost, | ||
ssh_key, | ||
) | ||
from .storage import config_psql_dos, postgres_cluster | ||
|
||
__all__ = ( | ||
'aiida_code_installed', | ||
'aiida_code', | ||
'aiida_computer_local', | ||
'aiida_computer_ssh', | ||
'aiida_computer', | ||
'aiida_config_factory', | ||
'aiida_config_tmp', | ||
'aiida_config', | ||
'aiida_localhost', | ||
'aiida_manager', | ||
'aiida_profile_clean_class', | ||
'aiida_profile_clean', | ||
'aiida_profile_factory', | ||
'aiida_profile_tmp', | ||
'aiida_profile', | ||
'config_psql_dos', | ||
'daemon_client', | ||
'entry_points', | ||
'postgres_cluster', | ||
'ssh_key', | ||
'started_daemon_client', | ||
'stopped_daemon_client', | ||
'submit_and_await', | ||
) | ||
|
||
|
||
# fmt: on |
Oops, something went wrong.