Consolidate duplicate and nested imports in test files#45
Merged
RobertBlackhart merged 2 commits intomainfrom Apr 17, 2026
Merged
Consolidate duplicate and nested imports in test files#45RobertBlackhart merged 2 commits intomainfrom
RobertBlackhart merged 2 commits intomainfrom
Conversation
Agent-Logs-Url: https://github.com/NetApp/recline/sessions/7a2eaa6c-36b6-4202-a8a1-aae1977a52f9 Co-authored-by: RobertBlackhart <5414318+RobertBlackhart@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix multiple instances of module imports in test files
Consolidate duplicate and nested imports in test files
Apr 17, 2026
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.
Several test modules imported the same modules multiple times, often inline within test function bodies rather than at the top of the file. This change hoists all imports to the module top and deduplicates them.
Changes
tests/test_commands/test_builtin_commands.py: hoistedcursesandReclineCommandError; removed 8 inlineimport recline, 2 inlineReclineCommandError, and 2 inlineimport curses.tests/test_commands/test_async_command.py: hoistedos,sys,termios,threading,time, and theasync_commandsymbols (CommandBackgrounded,CommandCancelled,set_terminal_echo); removed the corresponding inline duplicates.tests/test_repl/test_shell.py: hoistedreadline,sys,typing.Annotated,ReclineCommandError,builtin_commands as bc,CommandCancelled,CLICommand,OutputFormatter, and_split_unquoted; removed ~17 inline duplicates (notably 8×import builtinsand 3×_split_unquoted).Net effect: ~93 lines removed, ~23 added; no behavioral changes.
Example
Before:
After (imports already at top of file):
Original prompt
Created from VS Code.