Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
fix: reset Core._is_running before each test
Browse files Browse the repository at this point in the history
  • Loading branch information
trgiangdo committed Nov 3, 2023
1 parent 2b13eaa commit ed621ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/taipy/core/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Core:
Core service
"""

__is_running = False
_is_running = False
__lock_is_running = Lock()

__logger = _TaipyLogger._get_logger()
Expand All @@ -51,11 +51,11 @@ def run(self, force_restart=False):
This function checks the configuration, manages application's version,
and starts a dispatcher and lock the Config.
"""
if self.__class__.__is_running:
if self.__class__._is_running:
raise CoreServiceIsAlreadyRunning

with self.__class__.__lock_is_running:
self.__class__.__is_running = True
self.__class__._is_running = True

self.__update_and_check_config()
self.__manage_version()
Expand All @@ -78,7 +78,7 @@ def stop(self):
self.__logger.info("Core service has been stopped.")

with self.__class__.__lock_is_running:
self.__class__.__is_running = False
self.__class__._is_running = False

@staticmethod
def __update_and_check_config():
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from sqlalchemy.dialects import sqlite
from sqlalchemy.schema import CreateTable, DropTable

from src.taipy.core._core import Core
from src.taipy.core._orchestrator._orchestrator_factory import _OrchestratorFactory
from src.taipy.core._repository._sql_repository import connection
from src.taipy.core._version._version import _Version
Expand Down Expand Up @@ -410,6 +411,7 @@ def init_config():
_Checker.add_checker(_ScenarioConfigChecker)

Config.configure_core(read_entity_retry=0)
Core._is_running = False


def init_managers():
Expand Down

0 comments on commit ed621ce

Please sign in to comment.