Skip to content

Commit f11028a

Browse files
committed
Move to helper
1 parent f5cea8e commit f11028a

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

tests/helpers/fixtures.py

Lines changed: 12 additions & 0 deletions
Large diffs are not rendered by default.

tests/unit_tests/asyncio_/test_env_vars.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
import importlib
2-
import sys
3-
4-
5-
def import_fresh(modname: str):
6-
"""
7-
Imports or reloads the module from a fresh state.
8-
"""
9-
to_drop = [m for m in sys.modules if m == modname or m.startswith(modname + ".")]
10-
for m in to_drop:
11-
sys.modules.pop(m)
12-
return importlib.import_module(modname)
1+
from tests.helpers.fixtures import import_fresh
132

143

154
def test_env_vars(monkeypatch):

tests/unit_tests/sync/test_env_vars.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
import importlib
2-
import sys
3-
4-
5-
def import_fresh(modname: str):
6-
"""
7-
Imports or reloads the module from a fresh state.
8-
"""
9-
to_drop = [m for m in sys.modules if m == modname or m.startswith(modname + ".")]
10-
for m in to_drop:
11-
sys.modules.pop(m)
12-
return importlib.import_module(modname)
1+
from tests.helpers.fixtures import import_fresh
132

143

154
def test_env_vars(monkeypatch):

0 commit comments

Comments
 (0)