core: add tmp_config helper for test & adhoc patching
bluemaestro: cleanup tests
This commit is contained in:
parent
42399f6250
commit
5313984d8f
3 changed files with 21 additions and 17 deletions
|
@ -40,3 +40,11 @@ def override_config(config: F) -> Iterator[F]:
|
|||
# ugh. __dict__ of type objects isn't writable..
|
||||
for k, v in orig_properties.items():
|
||||
setattr(config, k, v)
|
||||
|
||||
|
||||
# helper for tests? not sure if could be useful elsewhere
|
||||
@contextmanager
|
||||
def tmp_config():
|
||||
import my.config as C
|
||||
with override_config(C):
|
||||
yield C # todo not sure?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue