Skip to content

refactor(tests): Parameterize duplicate tests across test suite#73

Merged
ivyleavedtoadflax merged 8 commits intomainfrom
refactor/parameterize-tests
Jan 24, 2026
Merged

refactor(tests): Parameterize duplicate tests across test suite#73
ivyleavedtoadflax merged 8 commits intomainfrom
refactor/parameterize-tests

Conversation

@ivyleavedtoadflax
Copy link
Owner

Summary

  • Parameterize duplicate AMI, snapshot, and volume instance resolution tests
  • Parameterize duplicate help flag tests in test_main.py
  • Parameterize duplicate count validation tests in test_ecs.py
  • Parameterize duplicate boundary tests in test_config.py
  • Parameterize duplicate pricing API filter tests
  • Parameterize duplicate flag tests in test_instance.py

Test plan

  • Run uv run pytest to verify all tests pass
  • Verify test coverage is maintained

Consolidate test_create_ami_instance_not_found and
test_create_ami_multiple_instances_found into a single parameterized test.
Both tests were functionally identical - mocking resolve_instance_or_exit
to raise typer.Exit(1) and verifying the exit code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tests

Consolidate test_list_snapshots_instance_not_found and
test_list_snapshots_multiple_instances_found into a single parameterized test.
Both tests were functionally identical - mocking resolve_instance_or_exit
to raise typer.Exit(1) and verifying the exit code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidate test_list_volumes_instance_not_found and
test_list_volumes_multiple_instances_found into a single parameterized test.
Both tests were functionally identical - mocking resolve_instance_or_exit
to raise typer.Exit(1) and verifying the exit code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidate test_should_show_logo_with_help_flag and
test_should_show_logo_with_h_flag into a single parameterized test.
Both tests were identical except for the flag used (--help vs -h).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…t_ecs.py

Consolidate test_scale_command_invalid_count_zero and
test_scale_command_invalid_count_negative into a single parameterized test.
Both tests were identical except for the count value (0 vs -1).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidate test_add_interactive_invalid_selection_too_high and
test_add_interactive_invalid_selection_zero into a single parameterized test.
Both tests were identical except for the invalid input (5 vs 0).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidate 5 nearly identical pricing API validation tests into a single
parameterized test. Tests for location, operatingSystem, tenancy,
preInstalledSw, and capacitystatus filters all shared ~30 lines of
duplicate code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidate flag tests for long/short flag variants into parameterized tests:
- --all/-a flag for including terminated instances
- --no-strict-host-key/-S flag for disabling strict host key checking
- --cost/-c flag for showing cost columns

Each pair of tests was identical except for the flag used.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ivyleavedtoadflax ivyleavedtoadflax merged commit c384c12 into main Jan 24, 2026
3 checks passed
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