Skip to content

Conversation

Copy link

Copilot AI commented Oct 3, 2025

Plan: Add --testcase-timeout CLI option

  • Explore codebase and understand timeout mechanism
  • Understand how CLI arguments are parsed and passed
  • Add TESTCASE_TIMEOUT default to defaults.py
  • Add --testcase-timeout CLI argument to parser.py
  • Pass testcase_timeout from CLI to TestRunner config
  • Update MultiTest to use default timeout from config
  • Create test to verify the feature
  • Update documentation to describe the new CLI option
  • Run comprehensive tests to ensure everything works
  • Allow 0 as valid timeout value to disable timeout
  • Make documentation more succinct per feedback
  • Fix terminology to use 'testsuite' consistently
  • Remove example file per feedback

Summary

Successfully implemented the --testcase-timeout CLI option that allows setting a default timeout for all testcases in a Testplan.

Changes Made:

  1. defaults.py: Added TESTCASE_TIMEOUT = None default value
  2. parser.py: Added --testcase-timeout CLI argument with helpful description
  3. runnable/base.py: Added testcase_timeout to TestRunnerConfig with validation allowing >= 0
  4. testing/multitest/base.py:
    • Added testcase_timeout parameter to MultiTest.init
    • Added testcase_timeout to MultiTestConfig options with validation allowing >= 0
    • Modified testcase execution to use default timeout from config if no explicit timeout is set
    • Updated MultiTest docstring to document the new parameter
  5. doc/en/multitest.rst: Added succinct documentation section with examples
  6. tests: Added comprehensive tests (test_default_testcase_timeout.py) demonstrating the feature

How it works:

  • Users can set a default testcase timeout via CLI: python my_test.py --testcase-timeout 60
  • Or programmatically: MultiTest(name="test", suites=[...], testcase_timeout=60)
  • Setting --testcase-timeout 0 disables the default timeout (equivalent to omitting the option)
  • If a testcase has an explicit timeout in its decorator, it overrides the default
  • Config inheritance ensures child MultiTests inherit the timeout from parent TestRunner config if not explicitly set
Original prompt

Testplan is a testing framework - read all about it in the repo docs. In particular read multitest -> testcase timeout. The testcase decorator accepts a timeout argument. I would like you to add a cli switch that when provided will set the default testcase timeout value, lets call it testcase-timeout. Currently the default is none, meaning no timeout. Add this feature. Include a tescase. Update the docs.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title Testplan is a testing framework - read all about it in the repo docs. In particular read multitest -> testcase timeout. The testcase decorator accepts a timeout argument. I would like you to add a cli switch that when provided will set the default test... Add --testcase-timeout CLI option to set default testcase timeout Oct 3, 2025
Copilot AI requested a review from butako October 3, 2025 21:04
Copilot finished work on behalf of butako October 3, 2025 21:04
It's useful when ``setup`` has much initialization work that takes long, e.g. connects to a server but has no response and makes program hanging. Note that this ``@timeout`` decorator can also be used for ``pre_testcase`` and ``post_testcase``, but that is not suggested because pre/post testcase methods are called everytime before/after each testcase runs, they should be written as simple as possible.
Default Testcase Timeout
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot this documentation is too verbose, can you make it more succinct.

Copy link
Author

Choose a reason for hiding this comment

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

Made the documentation more succinct in commit b098c68. Reduced from ~15 lines to 7 lines while keeping all essential information.

Copilot AI requested a review from butako October 4, 2025 20:05
Copilot finished work on behalf of butako October 4, 2025 20:05
mockplan.add(multitest)
mockplan.run()

# First test should pass (completes quickly)
Copy link
Owner

Choose a reason for hiding this comment

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

Correct terminology is 'testsuite' @copilot

Copy link
Author

Choose a reason for hiding this comment

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

Fixed terminology to use 'testsuite' in commit 94f645e.

Copilot AI requested a review from butako October 4, 2025 20:12
Copilot finished work on behalf of butako October 4, 2025 20:12
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot remove the example from the PR.

Copy link
Author

Choose a reason for hiding this comment

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

Removed the example file in commit a546315.

Copilot AI requested a review from butako October 14, 2025 19:37
Copilot finished work on behalf of butako October 14, 2025 19:37
@butako butako marked this pull request as ready for review October 14, 2025 19:38
@butako butako merged commit 51bf9f9 into main Oct 14, 2025
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.

2 participants