|
54 | 54 |
|
55 | 55 | WITHIN_PROVISION = os.environ.get(str("TOX_PROVISION")) == "1"
|
56 | 56 |
|
| 57 | +INTERRUPT_TIMEOUT = 0.3 |
| 58 | +TERMINATE_TIMEOUT = 0.2 |
| 59 | + |
57 | 60 |
|
58 | 61 | def get_plugin_manager(plugins=()):
|
59 | 62 | # initialize plugin manager
|
@@ -798,6 +801,20 @@ def develop(testenv_config, value):
|
798 | 801 |
|
799 | 802 | parser.add_testenv_attribute_obj(DepOption())
|
800 | 803 |
|
| 804 | + parser.add_testenv_attribute( |
| 805 | + name="interrupt_timeout", |
| 806 | + type="float", |
| 807 | + default=INTERRUPT_TIMEOUT, |
| 808 | + help="timeout before sending SIGTERM after SIGINT", |
| 809 | + ) |
| 810 | + |
| 811 | + parser.add_testenv_attribute( |
| 812 | + name="terminate_timeout", |
| 813 | + type="float", |
| 814 | + default=TERMINATE_TIMEOUT, |
| 815 | + help="timeout before sending SIGKILL after SIGTERM", |
| 816 | + ) |
| 817 | + |
801 | 818 | parser.add_testenv_attribute(
|
802 | 819 | name="commands",
|
803 | 820 | type="argvlist",
|
@@ -1231,7 +1248,8 @@ def make_envconfig(self, name, section, subs, config, replace=True):
|
1231 | 1248 | for env_attr in config._testenv_attr:
|
1232 | 1249 | atype = env_attr.type
|
1233 | 1250 | try:
|
1234 |
| - if atype in ("bool", "path", "string", "dict", "dict_setenv", "argv", "argvlist"): |
| 1251 | + if atype in ("bool", "float", "path", "string", |
| 1252 | + "dict", "dict_setenv", "argv", "argvlist"): |
1235 | 1253 | meth = getattr(reader, "get{}".format(atype))
|
1236 | 1254 | res = meth(env_attr.name, env_attr.default, replace=replace)
|
1237 | 1255 | elif atype == "basepython":
|
@@ -1448,6 +1466,22 @@ def _getdict(self, value, default, sep, replace=True):
|
1448 | 1466 |
|
1449 | 1467 | return d
|
1450 | 1468 |
|
| 1469 | + def getfloat(self, name, default=None, replace=True): |
| 1470 | + s = self.getstring(name, default, replace=replace) |
| 1471 | + if not s or not replace: |
| 1472 | + s = default |
| 1473 | + if s is None: |
| 1474 | + raise KeyError("no config value [{}] {} found".format(self.section_name, name)) |
| 1475 | + |
| 1476 | + if not isinstance(s, float): |
| 1477 | + try: |
| 1478 | + s = float(s) |
| 1479 | + except ValueError: |
| 1480 | + raise tox.exception.ConfigError( |
| 1481 | + "{}: invalid float {!r}".format(name, s) |
| 1482 | + ) |
| 1483 | + return s |
| 1484 | + |
1451 | 1485 | def getbool(self, name, default=None, replace=True):
|
1452 | 1486 | s = self.getstring(name, default, replace=replace)
|
1453 | 1487 | if not s or not replace:
|
|
0 commit comments