Skip to content

Commit d49b3ef

Browse files
committed
clear web modules dir after each test
1 parent 87f7664 commit d49b3ef

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import inspect
44
import os
5+
import shutil
56
from typing import Any, List
67

78
import pytest
@@ -11,6 +12,7 @@
1112
from selenium.webdriver.support.ui import WebDriverWait
1213

1314
import idom
15+
from idom.config import IDOM_WED_MODULES_DIR
1416
from idom.testing import ServerMountPoint, create_simple_selenium_web_driver
1517

1618

@@ -102,6 +104,15 @@ def driver_is_headless(pytestconfig: Config):
102104
return bool(pytestconfig.option.headless)
103105

104106

107+
@pytest.fixture(autouse=True)
108+
def _clear_web_modules_dir_after_test():
109+
for path in IDOM_WED_MODULES_DIR.current.iterdir():
110+
if path.is_dir():
111+
shutil.rmtree(path)
112+
else:
113+
path.unlink()
114+
115+
105116
def _mark_coros_as_async_tests(items: List[pytest.Item]) -> None:
106117
for item in items:
107118
if isinstance(item, pytest.Function):

0 commit comments

Comments
 (0)