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