-
Notifications
You must be signed in to change notification settings - Fork 6
Detect, Validate & Upgrade SAMM files via CLI prettyprint #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2d2bee1 to
8f2eea9
Compare
5e310da to
73494a9
Compare
286a277 to
469339d
Compare
703e820 to
cc4a1d6
Compare
- Enhance SAMM CLI functions with capture output option and update tests - Add ability to download samm-cli for macOS - Add archive extraction functionality to download_samm_cli - Add SAMM CLI installation and native dependencies to CI workflow - Stop running tests after the first failure - Refactor resource path in test_cli_functions to improve clarity and maintainability - Refactor SAMM CLI path retrieval for cross-platform compatibility
9cb09a8 to
fe467ed
Compare
88ce235 to
c888b97
Compare
| model_element_factory_mock.create_element.assert_called_once_with("aspect_urn") | ||
| validate_samm_namespace_version_mock.assert_called_once_with("rdf_graph_samm_graph") | ||
|
|
||
| class TestValidateSammNamespaceVersion: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need a separate class for testing one method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point, but I chose a class here mainly for three reasons:
-
Common setup / DRY principle
Using a test class allows me to apply the@mock.patchdecorator once at the class level, so that
get_samm_versions_from_graph_mock is injected into all test methods without repeating the patch in each one. -
Naming clarity
Instead of long method names like
test_validate_samm_namespace_version_valid/test_validate_samm_namespace_version_mismatch,
the class name already scopes the tests to_validate_samm_namespace_version.
Inside the class, method names can then be short and meaningful liketest_validandtest_mismatch. -
Future expansion / Better organization for related logic
Basically, it keeps all related tests grouped, which simplifies maintenance and extends naturally if the class grows.
If common mocks, fixtures, or shared setup become relevant to more than one test, a class-based approach makes them easier to share and keep consistent.
With a class, I can run all the related tests together (e.g., pytest::TestValidateSammNamespaceVersion) without having to run each function separately.
This makes running/debugging focused test groups much easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
Agrred with these arguments
Let's just place the code for the new TestValidateSammNamespaceVersion class after TestSAMMGraph
| return self._upgrade_ttl_file(source_path) | ||
|
|
||
| def _upgrade_data(self, data: str | bytes) -> str: | ||
| print( # TODO: improve logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imact 0:
You can create a task in backlog to analyze and implement a logging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0b99af4 to
b5f424d
Compare
atextor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
- Replaced SAMM version retrieval with default (latest) version - Updated integration tests from 2.1.0 → 2.2.0
b5f424d to
a4f9f59
Compare
Description
Introduces
AdaptiveGraphto centralize SAMM version management, with automated detection, namespace validation, and CLI‑driven upgrades that eliminate version mismatches across the codebase.adaptive_graph.pywithAdaptiveGraph(wraps rdflib.Graph, auto-detects SAMM version, validates, upgrades via SAMM CLI prettyprint)._validate_samm_namespace_versionmethod toSAMMGraphthat checks RDF graph namespaces for SAMM version consistency and raises aValueErrorif a mismatch is detected.Type of change
Checklist: