Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions .circleci/create_circleci_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,10 @@ def __post_init__(self):

def to_dict(self):
env = COMMON_ENV_VARIABLES.copy()
if self.job_name != "tests_hub":
# fmt: off
# not critical
env.update({"HF_TOKEN": "".join(["h", "f", "_", "H", "o", "d", "V", "u", "M", "q", "b", "R", "m", "t", "b", "z", "F", "Q", "O", "Q", "A", "J", "G", "D", "l", "V", "Q", "r", "R", "N", "w", "D", "M", "V", "C", "s", "d"])})
# fmt: on
# fmt: off
# not critical
env.update({"HF_TOKEN": "".join(["h", "f", "_", "H", "o", "d", "V", "u", "M", "q", "b", "R", "m", "t", "b", "z", "F", "Q", "O", "Q", "A", "J", "G", "D", "l", "V", "Q", "r", "R", "N", "w", "D", "M", "V", "C", "s", "d"])})
# fmt: on

# Do not run tests decorated by @is_flaky on pull requests
env['RUN_FLAKY'] = os.environ.get("CIRCLE_PULL_REQUEST", "") == ""
Expand Down Expand Up @@ -284,20 +283,6 @@ def job_name(self):
pytest_num_workers=4,
)

hub_job = CircleCIJob(
"hub",
additional_env={"HUGGINGFACE_CO_STAGING": True},
docker_image=[{"image":"huggingface/transformers-torch-light"}],
install_steps=[
'uv pip install .',
'git config --global user.email "ci@dummy.com"',
'git config --global user.name "ci"',
],
marker="is_staging_test",
pytest_num_workers=2,
resource_class="medium",
)

exotic_models_job = CircleCIJob(
"exotic_models",
docker_image=[{"image":"huggingface/transformers-exotic-models"}],
Expand Down Expand Up @@ -364,7 +349,7 @@ def job_name(self):
pytest_num_workers=1,
)

REGULAR_TESTS = [torch_job, hub_job, tokenization_job, processor_job, generate_job, non_model_job] # fmt: skip
REGULAR_TESTS = [torch_job, tokenization_job, processor_job, generate_job, non_model_job] # fmt: skip
EXAMPLES_TESTS = [examples_torch_job]
PIPELINE_TESTS = [pipelines_torch_job]
REPO_UTIL_TESTS = [repo_utils_job]
Expand Down
7 changes: 7 additions & 0 deletions tests/repo_utils/test_tests_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ def test_create_test_list_from_filter_routes_repo_utils_tests(self):
"tests/repo_utils/test_tests_fetcher.py",
]

def test_create_test_list_from_filter_does_not_create_hub_job(self):
with tempfile.TemporaryDirectory() as tmp_folder:
create_test_list_from_filter(["tests/models/bert/test_modeling_bert.py"], out_path=tmp_folder)

assert (Path(tmp_folder) / "tests_torch_test_list.txt").exists()
assert not (Path(tmp_folder) / "tests_hub_test_list.txt").exists()

def test_infer_tests_to_run_adds_repo_utils_for_utils_changes(self):
with ExitStack() as stack:
stack.enter_context(patch.object(tests_fetcher, "commit_flags", {"test_all": False}, create=True))
Expand Down
11 changes: 1 addition & 10 deletions utils/tests_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,6 @@ def parse_commit_message(commit_message: str) -> dict[str, bool]:
"tests_custom_tokenizers": r"tests/models/.*/test_tokenization_(?=bert_japanese|openai|clip).*",
"tests_repo_utils": r"tests/repo_utils/test_.*\.py",
"pipelines_torch": r"tests/models/.*/test_modeling_.*",
"tests_hub": r"tests/.*",
"tests_non_model": r"tests/[^/]*?/test_.*\.py",
"tests_training_ci": r"tests/models/.*/test_modeling_.*",
"tests_tensor_parallel_ci": r"(tests/models/.*/test_modeling_.*|tests/tensor_parallel(?:/test_tensor_parallel\.py)?)",
Expand All @@ -1111,21 +1110,13 @@ def create_test_list_from_filter(full_test_list, out_path):
to_output = []
for job_name, _filter in JOB_TO_TEST_FILE.items():
file_name = os.path.join(out_path, f"{job_name}_test_list.txt")
if job_name == "tests_hub":
files_to_test = ["tests"]
else:
files_to_test = list(re.findall(_filter, all_test_files))
files_to_test = list(re.findall(_filter, all_test_files))

print(job_name, file_name, len(files_to_test))

if len(files_to_test) > 0: # No tests -> no file with test list
to_output.append((job_name, file_name, files_to_test))

# Only get `tests_hub`, which means we have 0 test file for all other jobs --> No job at all to run.
if len(to_output) == 1:
print("No test file found for any job, skipping `tests_hub` as well.")
to_output = []

for _, file_name, files_to_test in to_output:
with open(file_name, "w") as f:
f.write("\n".join(files_to_test))
Expand Down
Loading