diff --git a/tests/storage/psql_dos/conftest.py b/tests/storage/psql_dos/conftest.py index 16136b8df9..c24db0ac72 100644 --- a/tests/storage/psql_dos/conftest.py +++ b/tests/storage/psql_dos/conftest.py @@ -13,17 +13,12 @@ from aiida.common.exceptions import MissingConfigurationError from aiida.manage.configuration import get_config +STORAGE_BACKEND_ENTRY_POINT = None try: if test_profile := os.environ.get('AIIDA_TEST_PROFILE'): STORAGE_BACKEND_ENTRY_POINT = get_config().get_profile(test_profile).storage_backend - # TODO: The else branch is wrong - else: - STORAGE_BACKEND_ENTRY_POINT = 'core.psql_dos' -except MissingConfigurationError: - # TODO: This is actually not true anymore! - # Case when ``pytest`` is invoked without existing config, in which case it will rely on the automatic test profile - # creation which currently always uses ``core.psql_dos`` for the storage backend - STORAGE_BACKEND_ENTRY_POINT = 'core.psql_dos' +except MissingConfigurationError as e: + raise ValueError(f"Could not parse configuration of AiiDA test profile '{test_profile}'") from e -if STORAGE_BACKEND_ENTRY_POINT != 'core.psql_dos': +if STORAGE_BACKEND_ENTRY_POINT is not None and STORAGE_BACKEND_ENTRY_POINT != 'core.psql_dos': collect_ignore_glob = ['*'] diff --git a/tests/storage/psql_dos/migrations/django_branch/test_migrate_to_head.py b/tests/storage/psql_dos/migrations/django_branch/test_migrate_to_head.py index 69c7e643d9..11f9fb8c3a 100644 --- a/tests/storage/psql_dos/migrations/django_branch/test_migrate_to_head.py +++ b/tests/storage/psql_dos/migrations/django_branch/test_migrate_to_head.py @@ -11,6 +11,15 @@ from aiida.storage.psql_dos.migrator import PsqlDosMigrator +def test_all_tests_marked_as_nightly(request): + """Test that all tests in this folder are tagged with 'nightly' marker""" + own_markers = [marker.name for marker in request.node.own_markers] + + assert len(own_markers) == 2 + assert 'nightly' in own_markers + assert 'requires_psql' in own_markers + + def test_migrate(perform_migrations: PsqlDosMigrator): """Test that the migrator can migrate from the base of the django branch, to the main head.""" perform_migrations.migrate_up('django@django_0001') # the base of the django branch diff --git a/tests/storage/psql_dos/test_backend.py b/tests/storage/psql_dos/test_backend.py index 6fe35ac747..bbc77b1a14 100644 --- a/tests/storage/psql_dos/test_backend.py +++ b/tests/storage/psql_dos/test_backend.py @@ -13,6 +13,14 @@ from aiida.orm import User +def test_all_tests_marked_with_requires_psql(request): + """Test that all tests in this folder are marked with 'requires_psql'""" + own_markers = [marker.name for marker in request.node.own_markers] + + assert len(own_markers) == 1 + assert own_markers[0] == 'requires_psql' + + @pytest.mark.usefixtures('aiida_profile_clean') def test_default_user(): assert isinstance(get_manager().get_profile_storage().default_user, User)