move environment to helpers module
This fixes registering pytest plugins
This commit is contained in:
14
pkgs/clan-cli/tests/helpers/environment.py
Normal file
14
pkgs/clan-cli/tests/helpers/environment.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import os
|
||||
from contextlib import contextmanager
|
||||
from typing import Iterator
|
||||
|
||||
|
||||
@contextmanager
|
||||
def mock_env(**environ: str) -> Iterator[None]:
|
||||
original_environ = dict(os.environ)
|
||||
os.environ.update(environ)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
os.environ.clear()
|
||||
os.environ.update(original_environ)
|
||||
Reference in New Issue
Block a user