Skip to content

Commit

Permalink
fixed paths for windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Christina Bukas committed Jan 11, 2024
1 parent 1d88e06 commit 6f4deec
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/client/test/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys

sys.path.append("../")
from dcp_client.utils import utils

Expand All @@ -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
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


0 comments on commit 6f4deec

Please sign in to comment.