diff --git a/lib/dl_api_lib_testing/dl_api_lib_testing/dataset_base.py b/lib/dl_api_lib_testing/dl_api_lib_testing/dataset_base.py index 979334517..ffb106967 100644 --- a/lib/dl_api_lib_testing/dl_api_lib_testing/dataset_base.py +++ b/lib/dl_api_lib_testing/dl_api_lib_testing/dataset_base.py @@ -10,7 +10,7 @@ class DatasetTestBase(ConnectionTestBase, metaclass=abc.ABCMeta): @abc.abstractmethod - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def dataset_params(self) -> dict: raise NotImplementedError diff --git a/lib/dl_connector_bundle_chs3/dl_connector_bundle_chs3_tests/db/base/core/base.py b/lib/dl_connector_bundle_chs3/dl_connector_bundle_chs3_tests/db/base/core/base.py index 3a662632f..4ec0bcaf3 100644 --- a/lib/dl_connector_bundle_chs3/dl_connector_bundle_chs3_tests/db/base/core/base.py +++ b/lib/dl_connector_bundle_chs3/dl_connector_bundle_chs3_tests/db/base/core/base.py @@ -59,7 +59,7 @@ class BaseCHS3TestClass(BaseConnectionTestClass[FILE_CONN_TV], metaclass=abc.ABC source_type: ClassVar[DataSourceType] - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def event_loop(self): """Avoid spontaneous event loop closes between tests""" loop = asyncio.get_event_loop() @@ -83,16 +83,16 @@ def db_url(self) -> str: def engine_config(self, db_url: str, engine_params: dict) -> ClickhouseDbEngineConfig: return ClickhouseDbEngineConfig(url=db_url, engine_params=engine_params) - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def conn_bi_context(self) -> RequestContextInfo: return RequestContextInfo(tenant=TenantCommon()) - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def redis_setting_maker(self) -> RedisSettingMaker: core_test_config = test_config.CORE_TEST_CONFIG return core_test_config.get_redis_setting_maker() - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def s3_settings(self) -> S3Settings: return S3Settings( ENDPOINT_URL=test_config.S3_ENDPOINT_URL, @@ -100,11 +100,11 @@ def s3_settings(self) -> S3Settings: SECRET_ACCESS_KEY=self.connection_settings.SECRET_ACCESS_KEY, ) - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def task_processor_factory(self) -> TaskProcessorFactory: return DummyTaskProcessorFactory() - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def conn_sync_service_registry( self, conn_bi_context: RequestContextInfo, @@ -116,7 +116,7 @@ def conn_sync_service_registry( task_processor_factory=task_processor_factory, ) - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def conn_async_service_registry( self, conn_bi_context: RequestContextInfo, diff --git a/lib/dl_connector_mssql/dl_connector_mssql_tests/db/core/test_data_source.py b/lib/dl_connector_mssql/dl_connector_mssql_tests/db/core/test_data_source.py index 25b29460a..cba98edec 100644 --- a/lib/dl_connector_mssql/dl_connector_mssql_tests/db/core/test_data_source.py +++ b/lib/dl_connector_mssql/dl_connector_mssql_tests/db/core/test_data_source.py @@ -94,7 +94,7 @@ class TestMSSQLSubselectByView( raw_sql_level = RawSQLLevel.subselect - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def initial_data_source_spec(self) -> SubselectDataSourceSpec: dsrc_spec = SubselectDataSourceSpec( source_type=SOURCE_TYPE_MSSQL_SUBSELECT, diff --git a/lib/dl_connector_oracle/dl_connector_oracle_tests/db/core/test_data_source.py b/lib/dl_connector_oracle/dl_connector_oracle_tests/db/core/test_data_source.py index fe39a3575..33f850ee3 100644 --- a/lib/dl_connector_oracle/dl_connector_oracle_tests/db/core/test_data_source.py +++ b/lib/dl_connector_oracle/dl_connector_oracle_tests/db/core/test_data_source.py @@ -99,7 +99,7 @@ class TestOracleSubselectByView( raw_sql_level = RawSQLLevel.subselect - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def initial_data_source_spec(self) -> SubselectDataSourceSpec: dsrc_spec = SubselectDataSourceSpec( source_type=SOURCE_TYPE_ORACLE_SUBSELECT, diff --git a/lib/dl_core_testing/dl_core_testing/testcases/connection_executor.py b/lib/dl_core_testing/dl_core_testing/testcases/connection_executor.py index 6702ed4fb..555ecb333 100644 --- a/lib/dl_core_testing/dl_core_testing/testcases/connection_executor.py +++ b/lib/dl_core_testing/dl_core_testing/testcases/connection_executor.py @@ -121,7 +121,7 @@ def check_closing_sql_sessions(self, db: Db) -> Generator[None, None, None]: class DefaultSyncConnectionExecutorTestSuite(DefaultSyncAsyncConnectionExecutorCheckBase[_CONN_TV], Generic[_CONN_TV]): - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def conn_exec_factory_async_env(self) -> bool: return False @@ -269,7 +269,7 @@ def test_get_table_schema_info_for_nonexistent_table( class DefaultAsyncConnectionExecutorTestSuite(DefaultSyncAsyncConnectionExecutorCheckBase[_CONN_TV], Generic[_CONN_TV]): - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def conn_exec_factory_async_env(self) -> bool: return True diff --git a/lib/dl_core_testing/dl_core_testing/testcases/service_base.py b/lib/dl_core_testing/dl_core_testing/testcases/service_base.py index 229c2b5ba..677e84924 100644 --- a/lib/dl_core_testing/dl_core_testing/testcases/service_base.py +++ b/lib/dl_core_testing/dl_core_testing/testcases/service_base.py @@ -51,7 +51,7 @@ class ServiceFixtureTextClass(metaclass=abc.ABCMeta): connection_settings: ClassVar[Optional[ConnectorSettingsBase]] = None inst_specific_sr_factory: ClassVar[Optional[InstallationSpecificServiceRegistryFactory]] = None - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def conn_us_config(self) -> USConfig: us_env_config = self.core_test_config.get_us_config() return USConfig( @@ -60,12 +60,12 @@ def conn_us_config(self) -> USConfig: us_crypto_keys_config=self.core_test_config.get_crypto_keys_config(), ) - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def conn_bi_context(self) -> RequestContextInfo: bi_context = RequestContextInfo.create_empty() return bi_context - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def conn_exec_factory_async_env(self) -> bool: return False @@ -101,7 +101,7 @@ def service_registry_factory( sr_future_ref.fulfill(service_registry) return service_registry - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def conn_sync_service_registry( self, conn_bi_context: RequestContextInfo, @@ -111,7 +111,7 @@ def conn_sync_service_registry( conn_bi_context=conn_bi_context, ) - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def conn_async_service_registry( self, conn_bi_context: RequestContextInfo, @@ -121,7 +121,7 @@ def conn_async_service_registry( conn_bi_context=conn_bi_context, ) - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def conn_default_service_registry( self, conn_exec_factory_async_env: bool, diff --git a/terrarium/dl_repmanager/dl_repmanager_tests/unit/base.py b/terrarium/dl_repmanager/dl_repmanager_tests/unit/base.py index 898c3c21c..eb7ae1385 100644 --- a/terrarium/dl_repmanager/dl_repmanager_tests/unit/base.py +++ b/terrarium/dl_repmanager/dl_repmanager_tests/unit/base.py @@ -97,7 +97,7 @@ def deployed_repo(repo_src: Path) -> Generator[Path, None, None]: class RepmanagerTestingBase: - @pytest.fixture(scope="session") + @pytest.fixture(scope="class") def repo_path(self) -> Generator[Path, None, None]: with deployed_repo(REPO_PATH) as repo_path: yield repo_path