Skip to content

Conversation

@ahouseholder
Copy link
Contributor

The JSON schema unit tests were failing because the local path substitution wasn't working consistently across different environments. This PR fixes that by computing a relative path from the test file in which it is called.

Copy link
Contributor

@sei-vsarvepalli sei-vsarvepalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #671 comment for the test scripts fix.

also use with... syntax to reduce filehandler boilerplate
@ahouseholder
Copy link
Contributor Author

Because our schemas are nested (they have internal pointers to other schemas we also run out of this repo), we can't just say "load the schema from a local file path" and be done with it. We appear to need the retrieval intercept that rewrites our URIs to file paths and loads from there. There might be something more we could do with the schema validator object, but that's going deeper into the validator API than I think we need to at this point.

I'm going to merge this since the tests work as-is. If we need to improve the tests, let's do a separate issue for that.

@ahouseholder ahouseholder merged commit f010679 into main Jan 22, 2025
3 checks passed
@ahouseholder ahouseholder deleted the feature/fix_unit_test branch January 22, 2025 21:34
@ahouseholder ahouseholder added this to the 1Q25 milestone Jan 22, 2025
ahouseholder added a commit that referenced this pull request Jan 24, 2025
* fix unit test

* add some comments explaining why we're doing it this way

also use with... syntax to reduce filehandler boilerplate
ahouseholder added a commit that referenced this pull request Jan 27, 2025
* fix unit test (#669)

* fix unit test

* add some comments explaining why we're doing it this way

also use with... syntax to reduce filehandler boilerplate

* use pydantic dataclasses

makes json roundtrip easier
also prepares for FastAPI adoption

# Conflicts:
#	src/ssvc/_mixins.py
#	src/ssvc/decision_points/cvss/base.py
#	src/ssvc_v2.py

* black reformat

* fix unit tests

* black reformat

* use native python types

* update dependencies

* wrap scripts in main() func

* regenerate with indented json

* black reformat

* add placeholder test
@ahouseholder ahouseholder self-assigned this Feb 24, 2025
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.

3 participants