Skip to content

Refactor tests/test_config.py to conform to unit test guidelines #85

Description

@bjester

Observed Behavior

tests/test_config.py diverges from the project's unit testing standards defined in .aiassistant/rules/tests.md:

  1. "Write one test case per class or function being tested": ConfigModelTestCase combines tests for RepositoryConfig, GlobalConfig, and ConfigManager. ConfigIOTestCase combines tests for ConfigIO, JsonConfigIO, and TomlConfigIO.
  2. "Name all test cases using the pascal case name of the class or function being tested, with the suffix TestCase": Classes like ConfigModelTestCase and ConfigIOTestCase do not correspond to the classes under test.
  3. Method naming rules (test_<method_name>__<behavior>): Many methods use ad-hoc names such as test_protocol_has_required_methods, test_config_io__raises_for_invalid_extension, etc.

Expected Behavior

tests/test_config.py should be organized with one TestCase per class under test (JsonConfigIOTestCase, TomlConfigIOTestCase, RepositoryConfigTestCase, GlobalConfigTestCase, ConfigManagerTestCase), with methods following the test_<method>__<behavior> convention.

Steps to Reproduce

  1. Compare tests/test_config.py against .aiassistant/rules/tests.md.
  2. Observe multiple classes tested inside ConfigModelTestCase (lines 137-197) and ConfigIOTestCase (lines 104-135).

Minimal Reproduction Environment / Conditions

  • Version / Branch / Commit: release-v0.5.x@6d07c0c
  • Component: tests/test_config.py

Deliverables & Testing Requirements

  • Refactor tests/test_config.py into distinct test case classes:
    • JsonConfigIOTestCase
    • TomlConfigIOTestCase
    • RepositoryConfigTestCase
    • GlobalConfigTestCase
    • ConfigManagerTestCase
  • Update method names to test_<method_name>__<behavior> pattern.
  • Verify full test suite passes without regressions (uv run pytest).

Technical Pointers & Root Cause Clues

  • Suspected Components: tests/test_config.py, .aiassistant/rules/tests.md
  • Related Commits: f96f3fb (Add support for TOML config and migrate to that)

Notes & Edge Cases

  • Preserves all existing assertions while aligning structure with style guide.

Metadata

Severity / Priority: P2 (Medium)
Area: testing, styleguide

AI Usage

Drafted with Gemini following the DEEP framework based on code review findings against release-v0.5.x. Reproduction conditions and code references were verified in the codebase.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    choremisc tasks

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions