Allow to add more information in is_flaky (#21426)

* Allow to add more information

* fix style

---------

Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
Yih-Dar
2023-02-02 17:41:22 +01:00
committed by GitHub
parent 8298e4ec02
commit 145bf41c13

View File

@@ -1690,7 +1690,7 @@ class RequestCounter:
return self.old_request(method=method, **kwargs) return self.old_request(method=method, **kwargs)
def is_flaky(max_attempts: int = 5, wait_before_retry: Optional[float] = None): def is_flaky(max_attempts: int = 5, wait_before_retry: Optional[float] = None, description: Optional[str] = None):
""" """
To decorate flaky tests. They will be retried on failures. To decorate flaky tests. They will be retried on failures.
@@ -1699,6 +1699,9 @@ def is_flaky(max_attempts: int = 5, wait_before_retry: Optional[float] = None):
The maximum number of attempts to retry the flaky test. The maximum number of attempts to retry the flaky test.
wait_before_retry (`float`, *optional*): wait_before_retry (`float`, *optional*):
If provided, will wait that number of seconds before retrying the test. If provided, will wait that number of seconds before retrying the test.
description (`str`, *optional*):
A string to describe the situation (what / where / why is flaky, link to GH issue/PR comments, errors,
etc.)
""" """
def decorator(test_func_ref): def decorator(test_func_ref):