File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -127,3 +127,19 @@ def dbt_dummy_postgres_config() -> PostgresConfig:
127127 port = 5432 ,
128128 schema = "schema" ,
129129 )
130+
131+
132+ @pytest .fixture (scope = "function" , autouse = True )
133+ def reset_dbt_globals ():
134+ # This fixture is used to clear the memoized cache for _get_package_with_retries
135+ # in dbt.clients.registry. This is necessary because the cache is shared across
136+ # tests and can cause unexpected behavior if not cleared as some tests depend on
137+ # the deprecation warning that _get_package_with_retries fires
138+ yield
139+ from dbt .clients .registry import _get_cached
140+ from dbt_common .events .functions import reset_metadata_vars
141+
142+ # https://github.com/dbt-labs/dbt-core/blob/main/core/dbt/tests/util.py#L82
143+ reset_metadata_vars ()
144+ # https://github.com/dbt-labs/dbt-core/blob/main/tests/functional/conftest.py#L9
145+ _get_cached .cache = {}
You can’t perform that action at this time.
0 commit comments