88###########################################################################
99"""Collection of ``pytest`` fixtures that are intended for use in plugin packages.
1010
11+ NOTE: These fixtures are deprecated! Use aiida.tools.pytest_fixtures instead.
12+
1113To use these fixtures, simply create a ``conftest.py`` in the tests folder and add the following line:
1214
1315 pytest_plugins = ['aiida.manage.tests.pytest_fixtures']
@@ -92,7 +94,7 @@ def postgres_cluster():
9294
9395 def create_database (
9496 database_name : str | None = None , database_username : str | None = None , database_password : str | None = None
95- ) -> t . Generator [ dict [str , str ], None , None ]:
97+ ) -> dict [str , str ]:
9698 from aiida .manage .external .postgres import Postgres
9799
98100 postgres_config = {
@@ -102,7 +104,7 @@ def create_database(
102104 'database_password' : database_password or 'guest' ,
103105 }
104106
105- postgres = Postgres (interactive = False , quiet = True , dbinfo = cluster .dsn )
107+ postgres = Postgres (interactive = False , quiet = True , dbinfo = cluster .dsn ) # type: ignore[union-attr]
106108 if not postgres .dbuser_exists (postgres_config ['database_username' ]):
107109 postgres .create_dbuser (
108110 postgres_config ['database_username' ], postgres_config ['database_password' ], 'CREATEDB'
@@ -146,7 +148,7 @@ def aiida_manager() -> Manager:
146148
147149@pytest .fixture (scope = 'session' )
148150def aiida_instance (
149- tmp_path_factory : pytest .tmpdir . TempPathFactory ,
151+ tmp_path_factory : pytest .TempPathFactory ,
150152 aiida_manager : Manager ,
151153 aiida_test_profile : str | None ,
152154) -> t .Generator [Config , None , None ]:
@@ -199,8 +201,8 @@ def aiida_instance(
199201
200202@pytest .fixture (scope = 'session' )
201203def config_psql_dos (
202- tmp_path_factory : pytest .tmpdir . TempPathFactory ,
203- postgres_cluster : dict [ str , str ] ,
204+ tmp_path_factory : pytest .TempPathFactory ,
205+ postgres_cluster : t . Any ,
204206) -> t .Callable [[dict [str , t .Any ] | None ], dict [str , t .Any ]]:
205207 """Return a profile configuration for the :class:`~aiida.storage.psql_dos.backend.PsqlDosBackend`."""
206208
@@ -253,7 +255,7 @@ def clear_profile():
253255 manager .reset_broker ()
254256 manager .reset_runner ()
255257
256- User (get_manager ().get_profile ().default_user_email ).store ()
258+ User (get_manager ().get_profile ().default_user_email ).store () # type: ignore[union-attr,arg-type]
257259
258260
259261@pytest .fixture (scope = 'session' )
@@ -295,7 +297,7 @@ def factory(custom_configuration: dict[str, t.Any] | None = None) -> Profile:
295297 },
296298 }
297299 recursive_merge (configuration , custom_configuration or {})
298- configuration ['test_profile' ] = True
300+ configuration ['test_profile' ] = True # type: ignore[assignment]
299301
300302 with contextlib .redirect_stdout (io .StringIO ()):
301303 profile_name = str (uuid .uuid4 ())
@@ -308,7 +310,7 @@ def factory(custom_configuration: dict[str, t.Any] | None = None) -> Profile:
308310
309311 aiida_manager .load_profile (profile_name , allow_switch = True )
310312
311- User (profile .default_user_email ).store ()
313+ User (profile .default_user_email ).store () # type: ignore[arg-type]
312314
313315 # Add the ``clear_profile`` method, such that users can empty the storage through the ``Profile`` instance that
314316 # is returned by this fixture. This functionality is added for backwards-compatibility as before the fixture
@@ -737,8 +739,8 @@ def _factory(
737739 :param kwargs: If the ``submittable`` is a process class, it is instantiated with the ``kwargs`` as inputs.
738740 :raises RuntimeError: If the process fails to achieve the specified state before the timeout expires.
739741 """
740- if inspect .isclass (submittable ) and issubclass (submittable , Process ):
741- node = submit (submittable , ** kwargs )
742+ if inspect .isclass (submittable ) and issubclass (submittable , Process ): # type: ignore[unreachable]
743+ node = submit (submittable , ** kwargs ) # type: ignore[unreachable]
742744 elif isinstance (submittable , ProcessBuilder ):
743745 node = submit (submittable )
744746 elif isinstance (submittable , ProcessNode ):
@@ -867,7 +869,7 @@ def remove(
867869
868870
869871@pytest .fixture
870- def entry_points (monkeypatch ) -> EntryPointManager :
872+ def entry_points (monkeypatch ) -> t . Generator [ EntryPointManager , None , None ] :
871873 """Return an instance of the ``EntryPointManager`` which allows to temporarily add or remove entry points.
872874
873875 This fixture monkey patches the entry point caches returned by
0 commit comments