Unverified Commit 89b00eef authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Fix expected value in tests of the test fetcher (#24077)

* Fix expected value in tests of the test fetcher

* Fix trigger for repo util tests
parent 5c9394b5
...@@ -526,10 +526,17 @@ src/transformers/configuration_utils.py ...@@ -526,10 +526,17 @@ src/transformers/configuration_utils.py
create_tmp_repo(tmp_folder) create_tmp_repo(tmp_folder)
expected_example_deps = { expected_example_deps = {
"examples/flax/test_flax_examples.py": ["examples/flax/text-classification/run_glue.py"], "examples/flax/test_flax_examples.py": [
"examples/pytorch/test_pytorch_examples.py": ["examples/pytorch/text-classification/run_glue.py"], "examples/flax/text-classification/run_glue.py",
"examples/flax/test_flax_examples.py",
],
"examples/pytorch/test_pytorch_examples.py": [
"examples/pytorch/text-classification/run_glue.py",
"examples/pytorch/test_pytorch_examples.py",
],
"examples/tensorflow/test_tensorflow_examples.py": [ "examples/tensorflow/test_tensorflow_examples.py": [
"examples/tensorflow/text-classification/run_glue.py" "examples/tensorflow/text-classification/run_glue.py",
"examples/tensorflow/test_tensorflow_examples.py",
], ],
} }
......
...@@ -353,7 +353,9 @@ def extract_imports(module_fname, cache=None): ...@@ -353,7 +353,9 @@ def extract_imports(module_fname, cache=None):
content = f.read() content = f.read()
# Filter out all docstrings to not get imports in code examples. # Filter out all docstrings to not get imports in code examples.
splits = content.split('"""') # fmt: off
splits = content.split('\"\"\"')
# fmt: on
content = "".join(splits[::2]) content = "".join(splits[::2])
module_parts = str(module_fname).split(os.path.sep) module_parts = str(module_fname).split(os.path.sep)
...@@ -694,12 +696,14 @@ def infer_tests_to_run(output_file, diff_with_last_commit=False, filter_models=T ...@@ -694,12 +696,14 @@ def infer_tests_to_run(output_file, diff_with_last_commit=False, filter_models=T
if f in test_map: if f in test_map:
test_files_to_run.extend(test_map[f]) test_files_to_run.extend(test_map[f])
test_files_to_run = sorted(set(test_files_to_run)) test_files_to_run = sorted(set(test_files_to_run))
# Remove repo utils tests
test_files_to_run = [f for f in test_files_to_run if not f.split(os.path.sep)[1] == "repo_utils"]
# Remove SageMaker tests # Remove SageMaker tests
test_files_to_run = [f for f in test_files_to_run if not f.split(os.path.sep)[1] == "sagemaker"] test_files_to_run = [f for f in test_files_to_run if not f.split(os.path.sep)[1] == "sagemaker"]
# Make sure we did not end up with a test file that was removed # Make sure we did not end up with a test file that was removed
test_files_to_run = [f for f in test_files_to_run if (PATH_TO_REPO / f).exists()] test_files_to_run = [f for f in test_files_to_run if (PATH_TO_REPO / f).exists()]
repo_utils_launch = any(f.split(os.path.sep)[1] == "repo_utils" for f in modified_files) repo_utils_launch = any(f.split(os.path.sep)[0] == "utils" for f in modified_files)
if repo_utils_launch: if repo_utils_launch:
repo_util_file = Path(output_file).parent / "test_repo_utils.txt" repo_util_file = Path(output_file).parent / "test_repo_utils.txt"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment