Skip to content

Strengthen unit test suite across eval, features, inference, models, split, and CLI#549

Open
smcolby wants to merge 4 commits into
mainfrom
test/broad-unit-test-refactor
Open

Strengthen unit test suite across eval, features, inference, models, split, and CLI#549
smcolby wants to merge 4 commits into
mainfrom
test/broad-unit-test-refactor

Conversation

@smcolby
Copy link
Copy Markdown
Contributor

@smcolby smcolby commented May 16, 2026

Description

Applies the new unit testing standards (introduced in #534) across the remainder of the unit test suite.

Changes

  • test_cli.py — Replace integration-style subprocess calls with direct function invocation; mocker-based patching for I/O side effects
  • test_comparison.py — Strengthen float assertions with pytest.approx(); adopt updated levene["stat"] dict key from posthoc refactor
  • test_data.py — Add missing docstrings; strengthen assertions
  • test_eval.py — Add docstrings; strengthen existing assertions (preserves RAE/log-unit metric tests from main)
  • test_features.py — Add mutual-exclusion checks on feature outputs; remove MagicMock on system under test
  • test_nepare.py — Add missing docstrings
  • test_inference.py — Full rewrite: real lightweight components,pytest-mock for side effects only, isinstance guards on outputs
  • test_base.py — Add missing docstrings (preserves weights_only load test from main)
  • test_lgbm.py — Add docstrings; strengthen assertions with pytest.approx()
  • test_splitters.py — Add mutual-exclusion assertions on all split strategies; diverse synthetic SMILES for scaffold/cluster splits

Quality Assurance & AI Policy

To maintain project quality and respect maintainer bandwidth, please confirm the following:

  • Manual Verification: I have manually reviewed and tested the code in this PR.
  • AI-Assisted Content: If AI tools were used (e.g., Copilot, ChatGPT), I have personally verified the logic, edge cases, and compliance with the existing codebase. I confirm the code is not a "blind" AI generation.
  • Minimal Review: I believe this PR is in a state that requires minimal intervention or correction from maintainers.
  • Scoped Change: This PR addresses a single, well-scoped issue rather than multiple unrelated changes.

Status

  • Ready to go (Checking this signals to maintainers that the PR is ready for final review)

Developers Certificate of Origin


Note to Contributors: We reserve the right to close PRs without review if they appear to lack human validation or do not meet the quality standards described in our CONTRIBUTING.md.

smcolby and others added 2 commits May 14, 2026 08:43
…split, and CLI

Apply testing standards from remove-parent-spec branch across the broad unit
test suite. Key changes:

- Replace integration-style tests with real lightweight components
- Remove MagicMock abuse on systems under test; keep mocks only for I/O
- Add pytest.approx throughout to prevent cross-platform floating-point failures
- Add mutual-exclusion assertions for all splitter tests
- Strengthen test_inference.py: real FingerprintFeaturizer, DummyRegressorModel,
  CommitteeRegressor; assert derived math values (PRED=1.0, STD=1.0, UCB=4.0)
- Add NumPy-style docstrings to all test functions
- Update test_cli.py for spec.run() call path (PR 3 API)
- test_eval.py: preserves RAE/log tests from main + docstrings/pytest.approx
- test_base.py: preserves weights_only load test from main + docstrings
- test_mtenn.py: not included (module deleted in main via #529)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve conflict in test_comparison.py: adopt ["stat"] dict key from main
(posthoc.py return structure change) while preserving pytest.approx()
assertions from this branch per testing standards.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

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

smcolby and others added 2 commits May 16, 2026 11:03
- Add autospec=True to inference_func and from_recipe patches in test_cli.py;
  convert mock_spec to create_autospec(AnvilSpecification, instance=True)
- Add autospec=True to both load_anvil_model_and_metadata patches in
  test_inference.py
- Add autospec=True to both featurize patches in test_features.py
- Replace monkeypatch.setattr + unittest.mock.Mock with mocker.patch /
  mocker.Mock in test_base.py; add docstring; remove stale import

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@smcolby smcolby requested a review from hmacdope May 17, 2026 01:48
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.

2 participants