From b1d6aceea6bb810b7958041b1dba6b7a0565e74b Mon Sep 17 00:00:00 2001 From: Amrit Ghimire Date: Thu, 17 Oct 2024 20:30:15 +0545 Subject: [PATCH] Make it compatible with windows --- src/datachain/utils.py | 2 -- tests/unit/test_config.py | 7 +++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/datachain/utils.py b/src/datachain/utils.py index 8cb6e72af..1bbb0c38e 100644 --- a/src/datachain/utils.py +++ b/src/datachain/utils.py @@ -42,7 +42,6 @@ class DataChainDir: TMP = "tmp" DB = "db" CONFIG = "config" - CONFIG = "config" ENV_VAR = "DATACHAIN_DIR" ENV_VAR_DATACHAIN_ROOT = "DATACHAIN_ROOT_DIR" @@ -53,7 +52,6 @@ def __init__( tmp: Optional[str] = None, db: Optional[str] = None, config: Optional[str] = None, - config: Optional[str] = None, ) -> None: self.root = osp.abspath(root) if root is not None else self.default_root() self.cache = ( diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py index bf4d90140..4b8df85e5 100644 --- a/tests/unit/test_config.py +++ b/tests/unit/test_config.py @@ -1,3 +1,5 @@ +import os + import pytest from tomlkit import TOMLDocument, dump @@ -49,14 +51,15 @@ def create_local_config(current_dir): "local-conf": "exists", } - with open(DataChainDir(current_dir + "/.datachain").config, "w") as f: + with open(DataChainDir(os.path.join(current_dir, ".datachain")).config, "w") as f: dump(conf, f) def test_get_dir(global_config_dir, system_config_dir, current_dir): assert Config.get_dir(ConfigLevel.GLOBAL) == global_config_dir assert Config.get_dir(ConfigLevel.SYSTEM) == system_config_dir - assert Config.get_dir(ConfigLevel.LOCAL) == current_dir + "/.datachain" + + assert Config.get_dir(ConfigLevel.LOCAL) == os.path.join(current_dir, ".datachain") def test_read_config(global_config_dir, system_config_dir, current_dir):