fix(linkml_files): correct GitHub raw/pages URLs and convert tests to pytest#257
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request updates linkml_model/linkml_files.py to generate correct GitHub Raw and GitHub Pages URLs for published schema/artifact files (which live under the linkml_model/ package directory), and modernizes the associated test suite by converting it from unittest to pytest.
Changes:
- Fix GitHub raw URL construction to include the
linkml_model/path prefix (branch/latest and tag-resolved URLs). - Add a
version="latest"parameter toGITHUB_IO_PATH_FORso GitHub Pages URLs can target versioned docs paths (<version>/linkml_model/...). - Convert
tests/test_linkml_files.pyto pytest, split coverage by function, and make GitHub-API network tests opt-in.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
linkml_model/linkml_files.py |
Updates GitHub URL builders to include the linkml_model/ package path; adds versioning support for GitHub Pages URLs. |
tests/test_linkml_files.py |
Migrates tests to pytest, updates expected URLs, and gates live GitHub API tests behind an environment variable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dalito
approved these changes
Jun 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two related changes to
linkml_model/linkml_files.pyand its tests:1. Fix broken GitHub URL builders
GITHUB_IO_PATH_FORandGITHUB_PATH_FOR(branch/latest) currently emit URLs that 404. The schema/artifact files are published under thelinkml_model/package directory on GitHub (both raw and GitHub Pages), but these builders omitted that path segment.LOCAL_PATH_FORwas unaffected because its base already points inside the package.Verified before/after (live
curl):| Function | before | after |
|
GITHUB_PATH_FOR(META, YAML, LATEST)|…/main/model/schema/meta.yaml→ 404 |…/main/linkml_model/model/schema/meta.yaml→ 200 ||
GITHUB_IO_PATH_FOR(META, YAML)|…/model/schema/meta.yaml→ 404 |…/latest/linkml_model/model/schema/meta.yaml→ 200 |GITHUB_IO_PATH_FORgains an optionalversion="latest"argument since the docs site is versioned (<version>/linkml_model/…). The signature change is backward-compatible.Known limitation: the tag/release path (
tag_to_commit) now also uses thelinkml_model/prefix, which is correct for all modern (v1.x) releases. Pre-restructure tags such asv0.0.1stored artifacts at the repo root, so URLs built for those very old tags are correct in form but will not resolve. Layout-aware detection was deliberately skipped as overkill.2. Convert
tests/test_linkml_files.pyto pytestReplaces the
unittest.TestCasestyle with functional pytest, and splits the monolithictest_basic_rulesso each function (URL_FOR,LOCAL_PATH_FOR,GITHUB_IO_PATH_FOR,GITHUB_PATH_FOR) is covered separately. The live GitHub-API test is now opt-in viaLINKML_TEST_GITHUB_API=1(rate-limited / flaky in CI) instead of a hardcoded skip flag.Context
This picks up the still-relevant pieces of the long-stale #201. The bulk of that PR (the
Format/_Pathrefactor) already landed onmainindependently; the URL fix and pytest conversion did not. #201 will be closed as superseded, referencing this PR.