Skip to content

Commit

Permalink
fix: reset everything after each test as well
Browse files Browse the repository at this point in the history
  • Loading branch information
trgiangdo committed Mar 5, 2024
1 parent 275fa36 commit fe2e46f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions tests/core/_orchestrator/test_orchestrator_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def test_build_unknown_dispatcher():
_OrchestratorFactory._build_dispatcher()
assert _OrchestratorFactory._dispatcher is None

Config.configure_job_executions(mode=JobConfig._DEVELOPMENT_MODE)
_OrchestratorFactory._build_dispatcher()


def test_remove_dispatcher_not_built():
_OrchestratorFactory._dispatcher = None
Expand Down
5 changes: 3 additions & 2 deletions tests/core/config/test_override_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ def test_override_default_configuration_with_code_configuration():
def test_override_default_config_with_code_config_including_env_variable_values():
Config.configure_core()
assert Config.core.repository_type == "filesystem"
Config.configure_core(repository_type="othertype")
assert Config.core.repository_type == "othertype"

with mock.patch.dict(os.environ, {"REPOSITORY_TYPE": "foo"}):
Config.configure_core(repository_type="ENV[REPOSITORY_TYPE]")
assert Config.core.repository_type == "foo"

Config.configure_core(repository_type="othertype")
assert Config.core.repository_type == "othertype"


def test_override_default_configuration_with_file_configuration():
tf = NamedTemporaryFile(
Expand Down
17 changes: 9 additions & 8 deletions tests/core/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,9 @@ def default_multi_sheet_data_frame():
def cleanup_files():
yield

if os.path.exists(".data"):
shutil.rmtree(".data", ignore_errors=True)
if os.path.exists("user_data"):
shutil.rmtree("user_data", ignore_errors=True)
if os.path.exists(".taipy"):
shutil.rmtree(".taipy", ignore_errors=True)
if os.path.exists(".my_data"):
shutil.rmtree(".my_data", ignore_errors=True)
for path in [".data", ".my_data", "user_data", ".taipy"]:
if os.path.exists(path):
shutil.rmtree(path, ignore_errors=True)


@pytest.fixture(scope="function")
Expand Down Expand Up @@ -332,6 +327,12 @@ def clean_repository(init_config, init_managers, init_orchestrator, init_notifie
with patch("sys.argv", ["prog"]):
yield

close_all_sessions()
init_orchestrator()
init_managers()
init_config()
init_notifier()


@pytest.fixture
def init_config(reset_configuration_singleton, inject_core_sections):
Expand Down

0 comments on commit fe2e46f

Please sign in to comment.