Skip to content

Commit 727b31c

Browse files
authored
Merge pull request #360 from dalito/issue2490-fix-hidden-windows-failures
Fix hidden windows failures
2 parents 6e796cb + b264c8e commit 727b31c

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.github/workflows/main.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
# coverage report
5050
#----------------------------------------------
5151
- name: Generate coverage results
52+
# Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668
53+
shell: bash
5254
run: |
5355
poetry run coverage run -m pytest
5456
poetry run coverage xml

linkml_runtime/linkml_model/linkml_files.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pathlib import Path
22
from enum import Enum, auto
3-
from typing import Dict, Optional, Union, Tuple, NamedTuple
3+
from typing import Dict, Optional, Union, NamedTuple
44
from urllib.parse import urljoin
55
from dataclasses import dataclass
66

@@ -84,7 +84,7 @@ class _Path:
8484
SHEXJ = FormatPath("shex","shexj" )
8585
SQLDDL = FormatPath("sqlddl","sql" )
8686
SQLSCHEMA = FormatPath("sqlschema","sql" )
87-
YAML = FormatPath(str(Path("model") / "schema"),"yaml" )
87+
YAML = FormatPath((Path("model") / "schema").as_posix(),"yaml" )
8888

8989
@classmethod
9090
def items(cls) -> Dict[str, FormatPath]:

linkml_runtime/utils/schemaview.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import os
2+
import sys
23
import uuid
34
import logging
45
import collections
56
from functools import lru_cache
67
from copy import copy, deepcopy
78
from collections import defaultdict, deque
8-
from pathlib import Path
9+
from pathlib import Path, PurePath
910
from typing import Mapping, Optional, Tuple, TypeVar
1011
import warnings
1112

@@ -28,6 +29,7 @@
2829
ENUMS = 'enums'
2930
SUBSETS = 'subsets'
3031
TYPES = 'types'
32+
WINDOWS = sys.platform == 'win32'
3133

3234
CLASS_NAME = Union[ClassDefinitionName, str]
3335
SLOT_NAME = Union[SlotDefinitionName, str]
@@ -304,7 +306,11 @@ def imports_closure(self, imports: bool = True, traverse: Optional[bool] = None,
304306
# we should treat the two `types.yaml` as separate schemas from the POV of the
305307
# origin schema.
306308
if sn.startswith('.') and ':' not in i:
307-
i = os.path.normpath(str(Path(sn).parent / i))
309+
if WINDOWS:
310+
# This cannot be simplified. os.path.normpath() must be called before .as_posix()
311+
i = PurePath(os.path.normpath(PurePath(sn).parent / i)).as_posix()
312+
else:
313+
i = os.path.normpath(str(Path(sn).parent / i))
308314
todo.append(i)
309315

310316
# add item to closure

0 commit comments

Comments
 (0)