Create a timeout_maximum flag so that we can prevent people from setting an insanely huge timeout to defeat the timeout feature.

Review Request #3219 - Created Dec. 7, 2015 and submitted

Sameer Brenn
benjyw, jsirois, stuhood

Creates a new timeout-maximum flag, if someone sets a timeout that exceeds that flag, then the timeout will be capped at that flag's level.

Also, start to deprecate timeout=0. Usage here has been very confusing, people thought that timeout=0 disabled the timeout, when really the behavior we have where the timeout can't be disabled is correct, if timeout=None then the default timeout should be used. timeout=0 should either really mean timeout=0 which fails the tests, or it should be prevented altogether. This RB just adds a warning if people use timeout=0.

./pants test tests/python/pants_test/task:testrunner_task_mixin
./pants test tests/python/pants_test/base:deprecated

Set timeout=0 in tests/python/pants_test/task:testrunner_task_mixin

./pants test tests/python/pants_test/task:testrunner_task_mixin

saw the warning:

09:23:49 00:01     [pytest]WARN] /Users/sbrenn/workspace/pants/src/python/pants/task/ DeprecationWarning: 
"Timeout for tests/python/pants_test/task:testrunner_task_mixin is 0" is deprecated and will be removed in version 0.0.65:
To use the default timeout remove the 'timeout' parameter from your test target.
  timeouts = [self._timeout_for_target(target) for target in targets]

Set timeout=10, saw the warning:
./pants test --test-pytest-timeout-maximum=5 tests/python/pants_test/task:testrunner_task_mixin

                   Warning: Timeout for tests/python/pants_test/task:testrunner_task_mixin (10s) exceeds 5s. Capping.

./pants test --test-pytest-timeout-default=20 --test-pytest-timeout-maximum=5 tests/python/pants_test/task:testrunner_task_mixin
Error: timeout-default: 5 exceeds timeout-maximum: 20
FAILURE: Error: timeout-default: 5 exceeds timeout-maximum: 20

Travis CI:


  • 0
  • 7
  • 1
  • 8
Description From Last Updated
Benjy Weinberger
Sameer Brenn
Stu Hood
Benjy Weinberger
Sameer Brenn
Benjy Weinberger
Sameer Brenn
Sameer Brenn
Review request changed

Status: Closed (submitted)

Change Summary:

Merged as f0a123d479b194a2dc229eb96c87abec23821791