Skip to content

Split tests into individual files#28

Merged
Xarthisius merged 1 commit into
mainfrom
test_refactor
Mar 28, 2026
Merged

Split tests into individual files#28
Xarthisius merged 1 commit into
mainfrom
test_refactor

Conversation

@Xarthisius
Copy link
Copy Markdown
Contributor

This pull request adds a comprehensive suite of unit and integration tests for the tro_utils package, focusing on its models and core functionality. It introduces shared fixtures and helper functions to streamline test setup, and covers serialization, deserialization, and behavior of key classes such as ArtifactArrangement, ArtifactComposition, ArtifactLocation, CompositionFingerprint, and HashValue. The tests ensure correct handling of extra vocabulary in JSON-LD contexts, artifact deduplication, fingerprinting, and roundtrip consistency.

Key changes include:

Test Infrastructure and Shared Utilities

  • Added shared fixtures in conftest.py for setting up temporary workspaces, GPG environments, and test profiles, enabling consistent and isolated test environments.
  • Introduced a helper function in helpers.py to create TRO objects with GPG configuration, simplifying cryptographic test setup.

Model Unit Tests

  • Added unit tests for ArtifactArrangement, verifying directory scanning, deduplication, snapshotting, and integration with TransparentResearchObject.
  • Added unit tests for ArtifactComposition, covering artifact addition, fingerprinting, and retrieval by hash or ID.
  • Added unit tests for ArtifactLocation, focusing on JSON-LD serialization and deserialization.
  • Added unit tests for CompositionFingerprint, ensuring deterministic computation and JSON-LD roundtrips.
  • Added unit tests for HashValue, testing parsing, serialization, legacy support, and equality.

Extra Context and JSON-LD Handling

  • Implemented tests for handling extra vocabulary in the @context of JSON-LD, including propagation, roundtrip persistence, and extension through the TRO facade.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.05%. Comparing base (567c995) to head (db5c15d).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #28      +/-   ##
==========================================
+ Coverage   94.86%   95.05%   +0.19%     
==========================================
  Files          15       15              
  Lines        1051     1051              
==========================================
+ Hits          997      999       +2     
+ Misses         54       52       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Xarthisius Xarthisius merged commit 49075ca into main Mar 28, 2026
8 checks passed
@Xarthisius Xarthisius deleted the test_refactor branch March 28, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant