File size: 487 Bytes
e40d9d0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import copy
from typing import Any
import pytest
from omegaconf.basecontainer import BaseContainer
@pytest.fixture(scope="function") # type: ignore
def restore_resolvers() -> Any:
"""
A fixture to restore singletons state after this the function.
This is useful for functions that are making a one-off change to singlestons that should not effect
other tests
"""
state = copy.deepcopy(BaseContainer._resolvers)
yield
BaseContainer._resolvers = state
|