diff --git a/tests/common/test_cli.py b/tests/common/test_cli.py index 1e62790..867da88 100644 --- a/tests/common/test_cli.py +++ b/tests/common/test_cli.py @@ -1,7 +1,7 @@ # Copyright (c) 2021-2024 CloudZero, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # Direct all questions to support@cloudzero.com -import os +from pathlib import Path from uca.common.cli import print_uca_sample from uca.common.files import load_jsonl @@ -17,7 +17,7 @@ def test_print_uca_sample(): """ # load sample uca data - uca_sample_data_path = os.path.join(os.path.dirname(__file__), "../data/sample_uca_data.jsonl") + uca_sample_data_path = str((Path(__file__).parent / "../data/sample_uca_data.jsonl").resolve()) uca_data = load_jsonl(uca_sample_data_path) print("Running test\n\n") diff --git a/tests/common/test_files.py b/tests/common/test_files.py index e3ea749..bab1c80 100644 --- a/tests/common/test_files.py +++ b/tests/common/test_files.py @@ -1,6 +1,7 @@ # Copyright (c) 2024 CloudZero, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # Direct all questions to support@cloudzero.com +from pathlib import Path from uca.common.files import load_data_files @@ -9,8 +10,9 @@ def test_load_data_files(): """ Test to load data files """ - data_files = load_data_files("../data/test_data.csv", "TEXT") + test_data_file = str((Path(__file__).parent / "../data/test_data.csv").resolve()) + data_files = load_data_files(test_data_file, "TEXT") assert len(data_files) == 13 - data_files = load_data_files("../data/test_data.csv", "CSV") + data_files = load_data_files(test_data_file, "CSV") assert len(data_files) == 12 diff --git a/tests/features/test_generate.py b/tests/features/test_generate.py index d8a91c4..160f4d0 100644 --- a/tests/features/test_generate.py +++ b/tests/features/test_generate.py @@ -3,7 +3,7 @@ # Direct all questions to support@cloudzero.com import datetime -import os +from pathlib import Path from uca.common.files import load_data_files from uca.features.generate import _render_uca_data, generate_uca @@ -66,8 +66,7 @@ def test_generate_uca_data_from_CSV(input_settings, input_template): None """ - test_data_file = os.path.join(os.path.dirname(__file__), "../data/test_data.csv") - + test_data_file = str((Path(__file__).parent / "../data/test_data.csv").resolve()) test_data = load_data_files(test_data_file, "CSV") uca_to_send = generate_uca(None, input_template, input_settings, test_data) assert len(uca_to_send) == 12