Skip to content

fix: discover async test functions - #101

Merged
fege merged 3 commits into
mainfrom
codex/discover-async-tests
Nov 24, 2026
Merged

fege merged 3 commits into
mainfrom
codex/discover-async-tests

Conversation

@Benkapner

Copy link
Copy Markdown
Member

Summary

list_test_functions.py only recognizes ast.FunctionDef, so existing async def test_* functions are missing from its output. The test-generation skill uses that output to detect already-implemented tests, so async cases can be generated again.

This PR includes ast.AsyncFunctionDef in the existing AST filter.

Related Issue

None - opened directly as a bug fix.

Changes

  • scripts/list_test_functions.py: recognize synchronous and asynchronous test definitions.
  • tests/consts/discovery_constants.py: add a mixed Python source fixture following the shared test-data convention.
  • tests/unit/test_list_test_functions.py: exercise the CLI and assert the complete JSON output, including names, line numbers, docstrings, and ordering.

Testing

  • Tests added for the modified logic
  • uv run --extra dev pre-commit run --all-files passes
  • make lint passes

uv run pytest tests/ -q --cov=scripts --cov-report=term-missing --cov-fail-under=70 passes on Python 3.14: 1,569 passed, 2 skipped, with 85.30% coverage.

The new regression test fails against the previous implementation, which returns only the synchronous test. It covers:

  • synchronous and plain async test functions
  • decorated async tests
  • async test methods inside a class
  • exclusion of async helper functions and methods
  • exact metadata, including absent docstrings

make lint reports one existing configuration warning: the installed skillsaw version no longer recognizes content-critical-position.

Checklist

  • PR title follows Conventional Commits
  • Commits are signed off (DCO)
  • I wrote this contribution myself and can explain all changes in it

Include async function definitions when listing existing Python tests.
Cover sync and async functions, decorators, class methods, and helper
exclusion through the CLI output.

Signed-off-by: Ben Kapner <benkapner@gmail.com>
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can pick a display mode instead of tweaking every Display option by hand

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Discover async test functions in test listings

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Include async test definitions when detecting already-implemented tests, preventing duplicate
 generation.
• Add a CLI regression test for mixed sync and async tests, metadata, ordering, and helper
 exclusion.
Diagram

graph TD
  CLI["CLI entry"] --> File["Python test file"] --> AST["AST parse"] --> Check{"Test definition?"} -->|Yes| Data["Test metadata"] --> JSON["JSON output"]
  Check -->|No| Skip["Ignore function"]
Loading
High-Level Assessment

Extending the existing AST filter is the most direct fix: it preserves the current metadata and output format without introducing a separate discovery path. A separate async pass would duplicate logic unnecessarily.

Files changed (3) +45 / -2

Bug fix (1) +1 / -1
list_test_functions.pyInclude async definitions in test discovery +1/-1

Include async definitions in test discovery

• The AST filter now accepts 'AsyncFunctionDef' alongside 'FunctionDef', so async tests—including methods—appear in the existing JSON output.

scripts/list_test_functions.py

Tests (2) +44 / -1
discovery_constants.pyAdd mixed test-discovery source fixture +23/-0

Add mixed test-discovery source fixture

• Defines source containing sync, async, decorated, and method tests alongside helpers for exclusion checks.

tests/consts/discovery_constants.py

test_list_test_functions.pyVerify CLI discovery of sync and async tests +21/-1

Verify CLI discovery of sync and async tests

• Adds a CLI regression test asserting the complete JSON output, including ordering, names, line numbers, docstrings, and exclusion of async helpers.

tests/unit/test_list_test_functions.py

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ❌ Failure (fullsend config could not be loaded, agent did not run: loading fullsend config: config.yaml: create_issues is no longer supported: move create_issues.allow_targets to tracker.<provider>.allowed_ta…) · Started 3:30 PM UTC · Completed 3:30 PM UTC

Commit: 8b51ba0 · View workflow run →

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ❌ Failure (fullsend config could not be loaded, agent did not run: loading fullsend config: config.yaml: create_issues is no longer supported: move create_issues.allow_targets to tracker.<provider>.allowed_ta…) · Started 8:59 AM UTC · Completed 8:59 AM UTC

Commit: 8b51ba0 · View workflow run →

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 12:41 PM UTC · Completed 12:47 PM UTC

Commit: ca92559 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.90

@fullsend-ai-review fullsend-ai-review Bot added the risk/low PR risk: low label Nov 23, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Risk Assessment: low (1/5)

Details

Small 47-line bug fix across 3 files with accompanying tests and zero recent git churn, keeping overall risk low despite touching a protected scripts path.

Previous run

Risk Assessment: low (1/5)

Details

Small 47-line bug fix across 3 files with accompanying tests and zero recent git churn, keeping overall risk low despite touching a protected scripts path.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Review

Findings

High

  • [protected-path] scripts/list_test_functions.py:68 — This PR modifies scripts/, a protected governance/infrastructure path that always requires human approval. The PR has no linked issue ("None - opened directly as a bug fix") and its description does not justify touching protected files, so there is insufficient authorization context.
    Remediation: Link or open an issue describing the async-test-discovery bug, or have a maintainer explicitly approve the change to scripts/list_test_functions.py.

Low

  • [missing-authorization] scripts/list_test_functions.py:68 — The PR has no linked issue; AGENTS.md ties changes to a linked issue's acceptance criteria and expects a Closes #NN reference. The change itself is tightly scoped (one isinstance check widened to include ast.AsyncFunctionDef, plus a fixture and a CLI test).
    Remediation: Open a tracking issue for the async test discovery bug and reference it in the PR and commit (Closes #NN).
  • [doc-style] tests/consts/discovery_constants.py:1 — The new constants module has no module-level docstring, unlike the sibling modules in tests/consts/ (markdown_constants.py, gaps_constants.py, calibration_constants.py, validation_constants.py, test_plan_constants.py).
    Remediation: Add a module-level docstring, e.g. """Test discovery fixtures for list_test_functions tests.""".

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W119 -->

Review

Findings

High

  • [protected-path] scripts/list_test_functions.py:68 — This PR modifies scripts/, a protected governance/infrastructure path that always requires human approval. The PR has no linked issue ("None - opened directly as a bug fix") and its description does not justify touching protected files, so there is insufficient authorization context.
    Remediation: Link or open an issue describing the async-test-discovery bug and its authorization, or have a maintainer explicitly approve the change to scripts/list_test_functions.py.

Labels: The PR is a bug fix to test-function discovery.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added the kind/bug Something isn't working label Nov 23, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 9:06 AM UTC · Completed 9:13 AM UTC

Commit: 62ac3f3 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.18

@fege fege left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @Benkapner

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the review comment for full details.

Comment thread scripts/list_test_functions.py Resolved
Comment thread scripts/list_test_functions.py Resolved
Comment thread tests/consts/discovery_constants.py Resolved
@fege
fege merged commit fa192cb into main Nov 24, 2026
34 checks passed
@fege
fege deleted the codex/discover-async-tests branch November 24, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working risk/low PR risk: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants