Add script to generate missing async tests using CST transformations#38
Merged
jason810496 merged 9 commits intoJan 6, 2026
Merged
Conversation
Distinguish sync and async operations in PGMQueue - Introduced a pre-commit hook to check for missing async methods in PGMQueue. - Added scripts to identify and generate missing async methods. - Created utility functions for AST manipulation and method transformation. - Established configuration for project paths and console output.
* Initial plan * Refactor AST-based code to use libcst for better code transformation Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix: only wrap call expressions in await, not literals Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Ask whether to apply change * Apply missing async methods * Correct files for check-sync-async-method-for-queue pre-commit * Add check for operation as well --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com>
Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
…cumentation Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add missing tests for async methods using CST approach
Add script to generate missing async tests using CST transformations
Jan 5, 2026
da8aba2 to
9e76606
Compare
jason810496
added a commit
that referenced
this pull request
Jan 6, 2026
* Add pre-commit hooks and scripts for async method checks in PGMQueue Distinguish sync and async operations in PGMQueue - Introduced a pre-commit hook to check for missing async methods in PGMQueue. - Added scripts to identify and generate missing async methods. - Created utility functions for AST manipulation and method transformation. - Established configuration for project paths and console output. * Refactor code transformation scripts from ast to libcst (#35) * Initial plan * Refactor AST-based code to use libcst for better code transformation Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix: only wrap call expressions in await, not literals Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Ask whether to apply change * Apply missing async methods * Correct files for check-sync-async-method-for-queue pre-commit * Add check for operation as well --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com> * Add script to generate missing async methods for PGMQOperation (#37) * Initial plan * Add compelete_missing_async_methods_for_operation.py script and operation_ast helper Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix path resolution bug in operation_ast.py Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Address code review feedback: improve docstring handling and remove unnecessary method Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Improve docstring handling robustness with better length checks Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix queue await error * Add script to generate missing async tests for PGMQOperation using CST (#39) * Add pre-commit hooks and scripts for async method checks in PGMQueue Distinguish sync and async operations in PGMQueue - Introduced a pre-commit hook to check for missing async methods in PGMQueue. - Added scripts to identify and generate missing async methods. - Created utility functions for AST manipulation and method transformation. - Established configuration for project paths and console output. * Refactor code transformation scripts from ast to libcst (#35) * Initial plan * Refactor AST-based code to use libcst for better code transformation Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix: only wrap call expressions in await, not literals Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Ask whether to apply change * Apply missing async methods * Correct files for check-sync-async-method-for-queue pre-commit * Add check for operation as well --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com> * Initial plan * Add compelete_missing_test_for_operation.py script with CST-based approach Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix code review feedback: remove redundant code and use Tuple from typing Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Finalize test_operation * Fix _check_pg_partman_ext naming --------- Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Add script to generate missing async tests using CST transformations (#38) * Add pre-commit hooks and scripts for async method checks in PGMQueue Distinguish sync and async operations in PGMQueue - Introduced a pre-commit hook to check for missing async methods in PGMQueue. - Added scripts to identify and generate missing async methods. - Created utility functions for AST manipulation and method transformation. - Established configuration for project paths and console output. * Refactor code transformation scripts from ast to libcst (#35) * Initial plan * Refactor AST-based code to use libcst for better code transformation Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix: only wrap call expressions in await, not literals Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Ask whether to apply change * Apply missing async methods * Correct files for check-sync-async-method-for-queue pre-commit * Add check for operation as well --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com> * Initial plan * Add complete_missing_test_for_queue.py script with CST-based approach Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Apply ruff formatting to test generation scripts Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Address code review feedback: fix path resolution, type hints, and documentation Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Fix missing async replacment for compelete test queue * Fix imports for async fixtures --------- Co-authored-by: LIU ZHE YOU <zhu424.dev@gmail.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: jason810496 <68415893+jason810496@users.noreply.github.com> * Unifing script name for queue * Add missing async test methods for queue, fix check_pg_partman_ext --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Implements
compelete_missing_test_for_queue.pyscript to automatically generate async test versions from sync tests intest_queue.py, following the CST-based pattern established bycompelete_missing_async_methods.py.Changes
scripts/compelete_missing_test_for_queue.py: Main script that parses test functions, identifies missing async versions (45 tests), generates them with proper transformations, and formats outputscripts/scripts_utils/test_ast.py: CST utilities for test transformationsAsyncTestTransformer: Convertspgmq.method()→await pgmq.method_async()andtime.sleep()→await asyncio.sleep()FillMissingTestsToModule: Inserts async tests after sync counterparts and adds asyncio importscripts/scripts_utils/config.py: Added test file path constantsExample transformation
Status
Checklist
pre-commitwithruff)✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.