@pytest.fixture(scope="function")
def editsdefaults():
restore = control.config.defaults.copy()
yield
control.config.defaults = restore.copy()
The fixture replaces the global config.config.defaults with a copy after the yield.
Other modules that have already imported control.config.defaults will still have their original reference.
A proper restore should replace all items in dictionary separately instead.