-
Notifications
You must be signed in to change notification settings - Fork 187
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
Make postgres_cluster
and config_psql_dos
fixtures configurable
#6254
Make postgres_cluster
and config_psql_dos
fixtures configurable
#6254
Conversation
@unkcpz would you care to have a look please? |
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.
Thanks @sphuber. The changes looks all good.
When I review the PR, it reminds me a warning exception in AiiDAlab test, I can confirm it comes from the It is a dummy test in After I comment out the
|
The `postgres_cluster` and `config_psql_dos` fixtures are made available publicly in order to help plugin packages with unit testing. Particularly, these fixtures should make it easy to generate test profiles using the `core.psql_dos` storage plugin, generating the postgres database in a test cluster that is created on-the-fly. The problem was that the interface did not actually allow to configure anything, such as the database name, but this was hardcoded. This would work fine in case it was used just once, but the fixtures could not be used to create a second profile, as the database name would already exist. The `postgres_cluster` fixture is turned into a factory, allowing the database name, username and password to be customized. The unbound method `create_database` is added to the `PGTest` instance that it returns to easily create a new database. The `config_psql_dos` fixture now actually forwards the relevant part of the `custom_configuration` to the `postgres_cluster.create_database` call. Finally, the `aiida_profile_factory` fixture factory now makes the `custom_configuration` argument actually optional, as originally was intended.
2d97f43
to
ac89e08
Compare
I have seen these warnings before as well, but haven't had the time to investigate it yet. The |
The
postgres_cluster
andconfig_psql_dos
fixtures are made available publicly in order to help plugin packages with unit testing. Particularly, these fixtures should make it easy to generate test profiles using thecore.psql_dos
storage plugin, generating the postgres database in a test cluster that is created on-the-fly.The problem was that the interface did not actually allow to configure anything, such as the database name, but this was hardcoded. This would work fine in case it was used just once, but the fixtures could not be used to create a second profile, as the database name would already exist.
The
postgres_cluster
fixture is turned into a factory, allowing the database name, username and password to be customized. The unbound methodcreate_database
is added to thePGTest
instance that it returns to easily create a new database.The
config_psql_dos
fixture now actually forwards the relevant part of thecustom_configuration
to thepostgres_cluster.create_database
call.Finally, the
aiida_profile_factory
fixture factory now makes thecustom_configuration
argument actually optional, as originally was intended.