Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ialarmedalien
Copy link
Collaborator

Tracking down some schema issues which involved stepping through the SchemaLoader code. Whilst doing so, I checked the tests for the schema loader and found that numerous tests had been disabled. I re-enabled the tests that passed and tidied up the test files a bit.

SchemaLoader does a lot of checks when loading up the schema, and ideally all these checks would be implemented as linter rules. Currently the linter will happily load files that make the SchemaLoader (and generators, etc., that rely on it) fail.

@ialarmedalien ialarmedalien self-assigned this Jul 23, 2025
description: type 'phenotype' is undefined

imports:
- ../../../includes/types
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

completely wrong

]


@pytest.mark.skip(reason="Re-enable this once we get fully migrated")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Re-enabled all these tests

SchemaLoader(fn).resolve()


@pytest.mark.skip(reason="Re-enable this once we get fully migrated")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Re-enabled

@codecov
Copy link

codecov bot commented Jul 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.14%. Comparing base (f6df34c) to head (f842525).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2834      +/-   ##
==========================================
+ Coverage   83.03%   83.14%   +0.11%     
==========================================
  Files         126      126              
  Lines       13994    13994              
  Branches     2900     2900              
==========================================
+ Hits        11620    11636      +16     
+ Misses       1737     1727      -10     
+ Partials      637      631       -6     

☔ 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.

SchemaLoader(fn).resolve()

@pytest.mark.parametrize(
("file", "error"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The majority of these tests were in the same form -- load a dodgy file, check the error message. I parametrised them to save on repetition of the same code.

SchemaLoader(fn).resolve()


@pytest.mark.skip(reason="Re-enable this once we get fully migrated")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

re-enabled

def test_type_definition_ok(input_path):
"""A type with either a typeof or uri is OK."""
fn = input_path("loaderpass11.yaml")
SchemaLoader(fn).resolve()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

add in some testing rather than just having a successful load being the test

SchemaLoader(fn).resolve()


@pytest.mark.skip(reason="Re-enable this once we get fully migrated")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

re-enabled

@iQuxLE iQuxLE requested a review from Copilot August 8, 2025 18:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR re-enables previously disabled SchemaLoader tests to improve test coverage and consolidates multiple error path tests into a more maintainable parameterized format.

Key changes:

  • Converts multiple individual test functions into a single parameterized test for error scenarios
  • Re-enables previously skipped tests by updating them to work with current SchemaLoader behavior
  • Updates test data files to have more accurate descriptions and proper import statements

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/test_utils/test_schemaloader.py Consolidates error path tests into parameterized format and re-enables disabled tests
tests/test_utils/input/loaderpass11.yaml Updates description to reflect actual test purpose
tests/test_utils/input/loadererror5.yaml Fixes imports and adds proper description
tests/test_utils/input/loadererror10.yaml Updates description to reflect actual test purpose

@ialarmedalien ialarmedalien merged commit e32f705 into main Aug 15, 2025
22 checks passed
@ialarmedalien ialarmedalien deleted the reenable_schema_loader_tests branch August 15, 2025 14:11
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