From 6f4deecc2a6a8c041706703d437e2e5e5bd052ad Mon Sep 17 00:00:00 2001 From: Christina Bukas Date: Thu, 11 Jan 2024 12:48:31 +0100 Subject: [PATCH] fixed paths for windows tests --- src/client/test/test_utils.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/client/test/test_utils.py b/src/client/test/test_utils.py index 20144c6..d09c8df 100644 --- a/src/client/test/test_utils.py +++ b/src/client/test/test_utils.py @@ -1,4 +1,5 @@ import sys + sys.path.append("../") from dcp_client.utils import utils @@ -15,11 +16,22 @@ def test_get_path_name(): assert utils.get_path_name(filepath)== 'something.txt' def test_get_path_parent(): - filepath = '/here/we/are/testing/something.txt' - assert utils.get_path_parent(filepath)== '/here/we/are/testing' + if sys.platform == 'win32' or sys.platform == 'cygwin': + filepath = '\\here\\we\\are\\testing\\something.txt' + assert utils.get_path_parent(filepath)== '\\here\\we\\are\\testing' + else: + filepath = '/here/we/are/testing/something.txt' + assert utils.get_path_parent(filepath)== '/here/we/are/testing' def test_join_path(): - filepath = '/here/we/are/testing/something.txt' - path1 = '/here/we/are/testing' - path2 = 'something.txt' - assert utils.join_path(path1, path2) == filepath \ No newline at end of file + if sys.platform == 'win32' or sys.platform == 'cygwin': + filepath = '\\here\\we\\are\\testing\\something.txt' + path1 = '\\here\\we\\are\\testing' + path2 = 'something.txt' + else: + filepath = '/here/we/are/testing/something.txt' + path1 = '/here/we/are/testing' + path2 = 'something.txt' + assert utils.join_path(path1, path2) == filepath + +