diff --git a/.github/workflows/test-upstream.yaml b/.github/workflows/test-upstream.yaml index eb3e9a0e..3614f896 100644 --- a/.github/workflows/test-upstream.yaml +++ b/.github/workflows/test-upstream.yaml @@ -42,7 +42,7 @@ jobs: run: | set +e set +o pipefail - + UPSTREAM_BRANCH=$( \ echo "$PR_BODY" | \ head -2 | \ @@ -52,12 +52,12 @@ jobs: ) echo "Got upstream branch:" echo $UPSTREAM_BRANCH - + if [[ -z "$UPSTREAM_BRANCH" ]]; then echo "Using main as default" UPSTREAM_BRANCH="main" fi - + UPSTREAM_REPO=$( \ echo "$PR_BODY" | \ head -2 | \ @@ -67,7 +67,7 @@ jobs: ) echo "Got upstream repo:" echo $UPSTREAM_REPO - + if [[ -z "$UPSTREAM_REPO" ]]; then echo "Using linkml/linkml as default" UPSTREAM_REPO="linkml/linkml" @@ -128,11 +128,6 @@ jobs: path: linkml/.venv key: venv-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} - # make extra sure we're removing any old version of linkml-runtime that exists - - name: uninstall potentially cached linkml-runtime - working-directory: linkml - run: poetry run pip uninstall -y linkml-runtime - # we are not using linkml-runtime's lockfile, but simulating what will happen # when we merge this and update linkml's lockfile - name: add linkml-runtime to lockfile @@ -145,7 +140,7 @@ jobs: # the cache will still speedup the rest of the installation - name: install linkml working-directory: linkml - run: poetry install --no-interaction -E tests + run: poetry sync --no-interaction --all-extras - name: print linkml-runtime version working-directory: linkml diff --git a/linkml_runtime/utils/schemaview.py b/linkml_runtime/utils/schemaview.py index 5356e54f..a20590b5 100644 --- a/linkml_runtime/utils/schemaview.py +++ b/linkml_runtime/utils/schemaview.py @@ -1213,6 +1213,9 @@ def get_uri( elif isinstance(e, SlotDefinition): uri = e.slot_uri e_name = underscore(e.name) + elif isinstance(e, EnumDefinition): + uri = e.enum_uri + e_name = e.name elif isinstance(e, TypeDefinition): uri = e.uri e_name = underscore(e.name) diff --git a/tests/test_utils/test_schemaview.py b/tests/test_utils/test_schemaview.py index a6fe6b31..fbacff5d 100644 --- a/tests/test_utils/test_schemaview.py +++ b/tests/test_utils/test_schemaview.py @@ -12,6 +12,7 @@ from linkml_runtime.linkml_model.meta import ( ClassDefinition, ClassDefinitionName, + EnumDefinition, Example, Prefix, SchemaDefinition, @@ -517,6 +518,9 @@ def test_imports(schema_view_with_imports: SchemaView) -> None: assert view.get_uri("TestClass", use_element_type=True) == "core:class/TestClass" assert view.get_uri("name", use_element_type=True) == "core:slot/name" + assert view.get_uri("OrganismType") == "ks:OrganismType" + assert view.get_uri("OrganismType", use_element_type=True) == "ks:enum/OrganismType" + assert view.get_uri("string") == "xsd:string" # dynamic enums @@ -988,6 +992,8 @@ def test_uris_without_default_prefix() -> None: view = SchemaView(schema_definition) view.add_class(ClassDefinition(name="TestClass", from_schema="https://example.org/another#")) view.add_slot(SlotDefinition(name="test_slot", from_schema="https://example.org/another#")) + view.add_enum(EnumDefinition(name="tEsT_enum", from_schema="https://example.org/another#")) assert view.get_uri("TestClass", imports=True) == "https://example.org/test#TestClass" assert view.get_uri("test_slot", imports=True) == "https://example.org/test#test_slot" + assert view.get_uri("tEsT_enum", imports=True) == "https://example.org/test#tEsT_enum"