diff --git a/src/sinol_make/helpers/package_util.py b/src/sinol_make/helpers/package_util.py index 150bc868..431f843c 100644 --- a/src/sinol_make/helpers/package_util.py +++ b/src/sinol_make/helpers/package_util.py @@ -84,7 +84,8 @@ class LimitTypes(Enum): MEMORY_LIMIT = 2 -def _get_limit_from_dict(dict: Dict[str, Any], limit_type: LimitTypes, test_id: str, test_group: str, test_path: str): +def _get_limit_from_dict(dict: Dict[str, Any], limit_type: LimitTypes, test_id: str, test_group: str, test_path: str, + allow_test_limit: bool = False): if limit_type == LimitTypes.TIME_LIMIT: limit_name = "time_limit" plural_limit_name = "time_limits" @@ -96,7 +97,10 @@ def _get_limit_from_dict(dict: Dict[str, Any], limit_type: LimitTypes, test_id: if plural_limit_name in dict: if test_id in dict[plural_limit_name] and test_id != "0": - util.exit_with_error(f'{os.path.basename(test_path)}: Specifying limit for single test is a bad practice and is not supported.') + if allow_test_limit: + return dict[plural_limit_name][test_id] + else: + util.exit_with_error(f'{os.path.basename(test_path)}: Specifying limit for single test is a bad practice and is not supported.') elif test_group in dict[plural_limit_name]: return dict[plural_limit_name][test_group] if limit_name in dict: @@ -108,9 +112,11 @@ def _get_limit_from_dict(dict: Dict[str, Any], limit_type: LimitTypes, test_id: def _get_limit(limit_type: LimitTypes, test_path: str, config: Dict[str, Any], lang: str): test_id = extract_test_id(test_path) test_group = str(get_group(test_path)) - global_limit = _get_limit_from_dict(config, limit_type, test_id, test_group, test_path) + allow_test_limit = config.get("sinol_undocumented_test_limits", False) + global_limit = _get_limit_from_dict(config, limit_type, test_id, test_group, test_path, allow_test_limit) override_limits_dict = config.get("override_limits", {}).get(lang, {}) - overriden_limit = _get_limit_from_dict(override_limits_dict, limit_type, test_id, test_group, test_path) + overriden_limit = _get_limit_from_dict(override_limits_dict, limit_type, test_id, test_group, test_path, + allow_test_limit) if overriden_limit is not None: return overriden_limit else: