Skip to content

Add test class organization guidelines to agent skills#1685

Merged
nathanjmcdougall merged 3 commits intomainfrom
copilot/improve-test-suite-instructions
Apr 1, 2026
Merged

Add test class organization guidelines to agent skills#1685
nathanjmcdougall merged 3 commits intomainfrom
copilot/improve-test-suite-instructions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 1, 2026

Agents were creating standalone top-level test classes for backend variants (e.g. TestAddDefaultGroupsPoetry) instead of nesting them inside existing test classes. The agent skills lacked guidance on the project's nested pytest class convention.

Added a "Test class organization" section to the usethis-python-test-full-coverage skill covering:

  • Top-level classes: one per function or class under test
  • Nested classes: group by method/operation, scenario/condition, or variant/backend
  • Variant-specific tests: must nest inside existing test classes, not create standalone classes
  • Nesting depth: 2–3 levels max
  • No docstrings: test names are self-documenting

Key convention illustrated:

# Correct — nest variant inside existing class
class TestAddDefaultGroups:
    class TestPoetry:
        def test_optional_group(self): ...

# Wrong — standalone class
class TestAddDefaultGroupsPoetry:
    def test_optional_group(self): ...

…verage skill

Adds a "Test class organization" section covering:
- Top-level classes: one per function or class under test
- Nested classes: group by method, operation, or variant
- Variant-specific tests must be nested inside existing test classes
- Nesting depth guidance (2-3 levels max)
- No docstrings on test classes or functions

Resolves #1645

Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/93d2f601-5c64-4f12-8343-b34a2973b558

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot AI changed the title [WIP] Update agent config for better test suite guidance Add test class organization guidelines to agent skills Apr 1, 2026
Copilot AI requested a review from nathanjmcdougall April 1, 2026 04:23
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review April 1, 2026 09:55
Comment thread .agents/skills/usethis-python-test-full-coverage/SKILL.md Outdated
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 1, 2026

@nathanjmcdougall I've opened a new pull request, #1704, to work on those changes. Once the pull request is ready, I'll request review from you.

…overage to new usethis-python-test skill (#1704)

* Initial plan

* Create usethis-python-test skill; move test class organization guidance out of usethis-python-test-full-coverage

Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/0336fce3-623f-4d2d-aad9-ced0c83edf6e

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
@nathanjmcdougall nathanjmcdougall merged commit 7e7ecea into main Apr 1, 2026
1 check passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/improve-test-suite-instructions branch April 1, 2026 10:18
@nathanjmcdougall nathanjmcdougall linked an issue Apr 1, 2026 that may be closed by this pull request
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.

Agent config should give better instructions on test suite structure Provide agent instructions on where to add new tests

2 participants