try to fix a test on windows

This commit is contained in:
burnettk 2022-12-11 00:03:46 -05:00
parent f851421346
commit 2c25e626e1
2 changed files with 9 additions and 1 deletions

View File

@ -1708,6 +1708,8 @@ def get_file_from_request() -> Any:
return request_file return request_file
# process_model_id uses forward slashes on all OSes
# this seems to return an object where process_model.id has backslashes on windows
def get_process_model(process_model_id: str) -> ProcessModelInfo: def get_process_model(process_model_id: str) -> ProcessModelInfo:
"""Get_process_model.""" """Get_process_model."""
process_model = None process_model = None

View File

@ -172,7 +172,6 @@ class ProcessModelService(FileSystemService):
cls, relative_path: str cls, relative_path: str
) -> ProcessModelInfo: ) -> ProcessModelInfo:
"""Get_process_model_from_relative_path.""" """Get_process_model_from_relative_path."""
process_group_identifier, _ = os.path.split(relative_path)
path = os.path.join(FileSystemService.root_path(), relative_path) path = os.path.join(FileSystemService.root_path(), relative_path)
return cls.__scan_process_model(path) return cls.__scan_process_model(path)
@ -430,6 +429,9 @@ class ProcessModelService(FileSystemService):
# process_group.process_groups.sort() # process_group.process_groups.sort()
return process_group return process_group
# path might have backslashes on windows, not sure
# not sure if os.path.join converts forward slashes in the relative_path argument to backslashes:
# path = os.path.join(FileSystemService.root_path(), relative_path)
@classmethod @classmethod
def __scan_process_model( def __scan_process_model(
cls, cls,
@ -446,6 +448,10 @@ class ProcessModelService(FileSystemService):
data.pop("process_group_id") data.pop("process_group_id")
# we don't save `id` in the json file, so we add it back in here. # we don't save `id` in the json file, so we add it back in here.
relative_path = os.path.relpath(path, FileSystemService.root_path()) relative_path = os.path.relpath(path, FileSystemService.root_path())
# even on windows, use forward slashes for ids
relative_path = relative_path.replace("\\", "/")
data["id"] = relative_path data["id"] = relative_path
process_model_info = ProcessModelInfo(**data) process_model_info = ProcessModelInfo(**data)
if process_model_info is None: if process_model_info is None: