Tests for MIOpen subcmd modules #1019
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Adding tests for subcmd modules, improving test coverage for the overall MITuna source code. The coverage report identified significant gaps in four key subcommand modules:
tuna/miopen/subcmd/export_db.py(47% coverage)tuna/miopen/subcmd/import_configs.py(70% coverage)tuna/miopen/subcmd/load_job.py(72% coverage)tuna/miopen/subcmd/merge_db.py(49% coverage)These modules handle critical database export/import operations, and the missing coverage represented untested error paths, edge cases, and conditional branches.
Technical Details
The tests cover the following areas:
export_db.py (
tests/test_export_db_branches.py):fin_net_cfg_jobadd_entry_to_solversbuild_miopen_fdbbuild_miopen_fdb_skewsandexport_kdbimport_configs.py (
tests/test_import_configs_branches.py):load_job.py (
tests/test_load_job_branches.py):merge_db.py (
tests/test_merge_db_branches.py):All tests use mocking/monkeypatching to avoid database dependencies and test logic in isolation.
Test Plan
Created four new test modules under
tests/:test_export_db_branches.py(12 tests)test_import_configs_branches.py(10 tests)test_load_job_branches.py(6 tests)test_merge_db_branches.py(8 tests)Integrated tests into CI pipeline (
vars/utils.groovy):python3 -m coverage run -a -m pytestFixed test failures:
test_build_miopen_pdbfor actual deduplication behaviorIntegrityErrorconstruction with required SQLAlchemy parametersTest Result
All 36 new tests pass successfully in CI:
These tests target previously uncovered lines/branches, improving coverage for the four subcommand modules.