Skip is_flaky tests in the CI (#37723)
* No more red flaky tests in the CI! * Remove the CircleCI logic as well * Revert most changes including is_flaky behaviour * make fixup * Move to a more sensible place * Mark a flaky test that failed on this PR! * correct import * update * update * update * update --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -28,6 +28,8 @@ COMMON_ENV_VARIABLES = {
|
|||||||
"TRANSFORMERS_IS_CI": True,
|
"TRANSFORMERS_IS_CI": True,
|
||||||
"PYTEST_TIMEOUT": 120,
|
"PYTEST_TIMEOUT": 120,
|
||||||
"RUN_PIPELINE_TESTS": False,
|
"RUN_PIPELINE_TESTS": False,
|
||||||
|
# will be adjust in `CircleCIJob.to_dict`.
|
||||||
|
"RUN_FLAKY": True,
|
||||||
}
|
}
|
||||||
# Disable the use of {"s": None} as the output is way too long, causing the navigation on CircleCI impractical
|
# Disable the use of {"s": None} as the output is way too long, causing the navigation on CircleCI impractical
|
||||||
COMMON_PYTEST_OPTIONS = {"max-worker-restart": 0, "vvv": None, "rsfE":None}
|
COMMON_PYTEST_OPTIONS = {"max-worker-restart": 0, "vvv": None, "rsfE":None}
|
||||||
@@ -126,6 +128,8 @@ class CircleCIJob:
|
|||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
env = COMMON_ENV_VARIABLES.copy()
|
env = COMMON_ENV_VARIABLES.copy()
|
||||||
|
# Do not run tests decorated by @is_flaky on pull requests
|
||||||
|
env['RUN_FLAKY'] = os.environ.get("CIRCLE_PULL_REQUEST", "") == ""
|
||||||
env.update(self.additional_env)
|
env.update(self.additional_env)
|
||||||
|
|
||||||
job = {
|
job = {
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ def parse_int_from_env(key, default=None):
|
|||||||
|
|
||||||
|
|
||||||
_run_slow_tests = parse_flag_from_env("RUN_SLOW", default=False)
|
_run_slow_tests = parse_flag_from_env("RUN_SLOW", default=False)
|
||||||
|
_run_flaky_tests = parse_flag_from_env("RUN_FLAKY", default=True)
|
||||||
_run_custom_tokenizers = parse_flag_from_env("RUN_CUSTOM_TOKENIZERS", default=False)
|
_run_custom_tokenizers = parse_flag_from_env("RUN_CUSTOM_TOKENIZERS", default=False)
|
||||||
_run_staging = parse_flag_from_env("HUGGINGFACE_CO_STAGING", default=False)
|
_run_staging = parse_flag_from_env("HUGGINGFACE_CO_STAGING", default=False)
|
||||||
_run_pipeline_tests = parse_flag_from_env("RUN_PIPELINE_TESTS", default=True)
|
_run_pipeline_tests = parse_flag_from_env("RUN_PIPELINE_TESTS", default=True)
|
||||||
@@ -2614,7 +2615,7 @@ def is_flaky(max_attempts: int = 5, wait_before_retry: Optional[float] = None, d
|
|||||||
|
|
||||||
return test_func_ref(*args, **kwargs)
|
return test_func_ref(*args, **kwargs)
|
||||||
|
|
||||||
return wrapper
|
return unittest.skipUnless(_run_flaky_tests, "test is flaky")(wrapper)
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user