Skip to content

[MAINTENANCE] Type-check tests/core/ #12130

Description

@joshua-stauffer

Part of #12128.

What to do

Bring the six excluded modules under tests/core/ into the type-check: fix the 178 errors
mypy reports there, then remove the six covering exclude patterns from pyproject.toml and
regenerate the relaxation inventory in the same change.

Fix each error by correcting the test against the library's current contract, never by
silencing it. A call written f(**{...}) is checked as one argument against the first
parameter, which turns a whole literal into one useless diagnostic per candidate parameter;
written as direct keyword arguments it is checked argument by argument. That transform — same
argument order, byte-identical value expressions — is most of this issue.

Where

  • tests/core/test_batch.py — 122 errors, 85 of them one **dict splat into
    get_batch_request_from_acceptable_arguments across 17 call sites.
  • tests/core/test_expectation_validation_result.py — 43 errors, 42 the same splat shape into
    the ExpectationValidationResult constructor. The 43rd is at line 328: a fixture built as
    ExpectationSuiteValidationResultMeta(...) that omits batch_parameters, checkpoint_id
    and validation_id, so it does not match the TypedDict it claims to instantiate.
  • test_expectation_suite.py (5), test_validation_definition.py (4),
    test_expectation_configuration.py (2), test_yaml_handler.py (2).
  • pyproject.toml — remove the six exclude entries naming tests/core/….
  • scripts/mypy_relaxation_inventory.json — regenerate with the guard's emit mode, never by hand.

How to verify

pip install -r requirements-types.txt -r reqs/requirements-dev-contrib.txt
# remove the six tests/core/ lines from the exclude list in pyproject.toml, then:
python scripts/mypy_config_guard.py --emit-inventory > scripts/mypy_relaxation_inventory.json
invoke type-check --ci --pretty
pytest tests/core/

Before: 178 errors in six files; 783 source files checked (at 2c4123fa9).
After: zero errors; 789 checked; pytest tests/core/ passing as it does today.

Requirements

  1. When the type-check runs on the merged change, it reports zero errors and no exclude
    pattern naming a path under tests/core/ remains.
  2. Completing the fixture at line 328 must not change what its test observes. If supplying the
    three missing keys makes the test fail, that is evidence about the library — comment here
    rather than adjusting the test until it passes.
  3. No test may be weakened: no assertion deleted or made vacuous, no expected value loosened,
    no Any or cast hiding a real mismatch, no new skip or xfail.
  4. pytest tests/core/ must pass with the same outcomes as before.
  5. The inventory must be regenerated by python scripts/mypy_config_guard.py --emit-inventory
    in the same change, and the guard must pass.
  6. No file under great_expectations/ may change, and no test function signature may gain
    annotations. If the correct fix looks like it lies in library code, comment here instead.

Out of scope: every exclude pattern outside tests/core/; the follow_imports = 'silent'
override block; any mypy strictness flag; annotations on test function signatures.

Notes

  • Do the two splat clusters first: they are 127 of the 178 errors and collapse fast, leaving a
    short tail of genuine stale-signature fixes.

Metadata

Metadata

Labels

claimedA contributor has claimed this issue and is actively working it (bot-managed)help wantedIssues we'd love to see community contributions for. Join #contributors-contributing in our Slack!maintenanceready-for-workTriaged, accepted, and specified well enough to start today -- the claiming gate

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions