@@ -560,7 +560,10 @@ def construct_nested_folders(
560560 # IMPORTANT: Use session_node["path"] directly as it's already a pathlib.Path object
561561 # Do NOT use get_node_path(session_node["path"]) as get_node_path expects pytest objects,
562562 # not Path objects directly.
563- common_parent = os .path .commonpath ([file_node ["path" ], session_node ["path" ]])
563+ # Convert Path objects to strings for os.path.commonpath
564+ file_path_str : str = str (file_node ["path" ])
565+ session_path_str : str = str (session_node ["path" ])
566+ common_parent = os .path .commonpath ([file_path_str , session_path_str ])
564567 common_parent_path = pathlib .Path (common_parent )
565568 print ("[vscode-pytest]: Session node now set to: " , common_parent )
566569 session_node ["path" ] = common_parent_path # pathlib.Path
@@ -953,7 +956,10 @@ def get_node_path(
953956 # Get relative between the cwd (resolved path) and the node path.
954957 try :
955958 # Check to see if the node path contains the symlink root already
956- common_path = os .path .commonpath ([SYMLINK_PATH , node_path ])
959+ # Convert Path objects to strings for os.path.commonpath
960+ symlink_str : str = str (SYMLINK_PATH )
961+ node_path_str : str = str (node_path )
962+ common_path = os .path .commonpath ([symlink_str , node_path_str ])
957963 if common_path == os .fsdecode (SYMLINK_PATH ):
958964 # The node path is already relative to the SYMLINK_PATH root therefore return
959965 return node_path
0 commit comments