Skip to content

Clean up test runner: convert languages.json to Python, consolidate proto files - #75

Merged
rijesha merged 6 commits into
mainfrom
copilot/clean-up-test-runner-code
Dec 5, 2025
Merged

Clean up test runner: convert languages.json to Python, consolidate proto files#75
rijesha merged 6 commits into
mainfrom
copilot/clean-up-test-runner-code

Conversation

Copilot AI commented Dec 5, 2025

Copy link
Copy Markdown
Contributor
  • Convert languages.json to languages.py with direct Python calls
  • Remove base_language and languages_file fields from test_config.json
  • Combine four proto files into single test_messages.proto file
  • Refactored languages.py with Language base class with action methods:
    • check_compiler() / check_interpreter() / check_tools() - Tool availability checking
    • compile() / compile_project() - Compilation actions
    • run() / run_project() / get_env() - Execution actions
  • Removed to_dict() and updated runner code to use Language instances directly (per review feedback):
    • Removed to_dict() method from Language class
    • Removed get_languages_dict() function
    • Updated runner/base.py to use get_lang() method to get Language instances
    • Updated runner/tool_checker.py to use Language's check_tools() method
    • Updated runner/compiler.py to use Language's compile() and compile_project() methods
    • Updated runner/code_generator.py to access Language properties directly
    • Updated runner/output_formatter.py to use Language instances
    • Updated runner/test_executor.py to use Language instances
    • Updated runner/runner.py to use Language instances
    • Updated runner/plugins.py to use Language instances via executor.get_lang()
    • Updated run_tests.py clean_test_files to use Language instances
  • All tests pass (106/107 - same as baseline)
Original prompt

This section details on the original issue you should resolve

<issue_title>Clean up test runner code</issue_title>
<issue_description>The test runner code is very large and hard to understand.

There is a language.json file, if this is converted to a language.py file that could reduce the amount of required code. There can just be direct calls for different steps.

review everything in the runner folder to see where else complexity may be reduced.

  "base_language": "c",
  
  "languages_file": "languages.json",

should be removed from test_config.json and be part of the language.py file.

The four different protofiles should just be combined into a single file called test_messages.proto
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 5, 2025 18:09
…mbine proto files

Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
…dMessage exclusion

Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
Copilot AI changed the title [WIP] Clean up test runner code for better clarity Clean up test runner: convert languages.json to Python, consolidate proto files Dec 5, 2025
Copilot AI requested a review from rijesha December 5, 2025 18:14
Comment thread tests/languages.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR should refactor this further.

Create a python language base class that has the functions compiler check, interpreter check, and runner check. Then also a compile, interpret, and run functions that take arguments.

This file should be less of a config that is passed and more of boilerplate code that will actually do actions for each language.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Refactored languages.py with a Language base class that includes action methods:

  • check_compiler() / check_interpreter() / check_tools() - Tool availability checking
  • compile() / compile_project() - Compilation actions
  • run() / run_project() / get_env() - Execution actions

Each language (C, C++, Python, TypeScript, JavaScript, GraphQL, C#) is now a subclass with its own implementation. The to_dict() method provides backward compatibility with existing runner code.

See commits c58db3c and 63082fa.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In this PR remove to_dict() and modify the runner code to use the new language classes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed to_dict() and refactored all runner code to use Language instances directly. The runner now accesses Language properties directly (e.g., lang.name, lang.compiler, lang.get_build_dir()) instead of through dictionary lookups.

Key changes:

  • runner/base.py: Added get_lang() method to get Language instances
  • runner/tool_checker.py: Uses Language's check_tools() method
  • runner/compiler.py: Uses Language's compile() and compile_project() methods
  • runner/plugins.py: Uses Language instances via executor.get_lang()
  • All other runner modules updated similarly

See commit bf10538.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in commit bf10538. The to_dict() method has been removed and all runner code now uses Language instances directly.

Copilot AI and others added 2 commits December 5, 2025 19:29
Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
…used ABC import

Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
Copilot AI requested a review from rijesha December 5, 2025 19:35
Comment thread tests/languages.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In this PR remove to_dict() and modify the runner code to use the new language classes.

Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
Copilot AI requested a review from rijesha December 5, 2025 21:20
@rijesha
rijesha marked this pull request as ready for review December 5, 2025 21:23
@rijesha
rijesha merged commit 9799102 into main Dec 5, 2025
2 checks passed
@rijesha
rijesha deleted the copilot/clean-up-test-runner-code branch December 6, 2025 03:20
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.

Clean up test runner code

2 participants