clear custom compoent cache between app harness tests
This commit is contained in:
parent
e71756050e
commit
3da4f6d338
@ -23,6 +23,8 @@ from typing import (
|
||||
Union,
|
||||
)
|
||||
|
||||
from typing_extensions import Self
|
||||
|
||||
import reflex.state
|
||||
from reflex.base import Base
|
||||
from reflex.compiler.templates import STATEFUL_COMPONENT
|
||||
@ -685,7 +687,7 @@ class Component(BaseComponent, ABC):
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def create(cls, *children, **props) -> Component:
|
||||
def create(cls, *children, **props) -> Self:
|
||||
"""Create the component.
|
||||
|
||||
Args:
|
||||
|
@ -43,6 +43,7 @@ import reflex.utils.exec
|
||||
import reflex.utils.format
|
||||
import reflex.utils.prerequisites
|
||||
import reflex.utils.processes
|
||||
from reflex.components.component import CustomComponent
|
||||
from reflex.config import environment
|
||||
from reflex.state import (
|
||||
BaseState,
|
||||
@ -254,6 +255,7 @@ class AppHarness:
|
||||
# disable telemetry reporting for tests
|
||||
|
||||
os.environ["TELEMETRY_ENABLED"] = "false"
|
||||
CustomComponent.create().get_component.cache_clear()
|
||||
self.app_path.mkdir(parents=True, exist_ok=True)
|
||||
if self.app_source is not None:
|
||||
app_globals = self._get_globals_from_signature(self.app_source)
|
||||
|
@ -253,15 +253,12 @@ def get_reload_dirs() -> list[Path]:
|
||||
if config.app_module is not None and config.app_module.__file__:
|
||||
module_path = Path(config.app_module.__file__).resolve().parent
|
||||
|
||||
while module_path.parent.name:
|
||||
if any(
|
||||
sibling_file.name == "__init__.py"
|
||||
for sibling_file in module_path.parent.iterdir()
|
||||
):
|
||||
# go up a level to find dir without `__init__.py`
|
||||
module_path = module_path.parent
|
||||
else:
|
||||
break
|
||||
while module_path.parent.name and any(
|
||||
sibling_file.name == "__init__.py"
|
||||
for sibling_file in module_path.parent.iterdir()
|
||||
):
|
||||
# go up a level to find dir without `__init__.py`
|
||||
module_path = module_path.parent
|
||||
|
||||
reload_dirs = [module_path]
|
||||
return reload_dirs
|
||||
|
Loading…
Reference in New Issue
Block a user