Skip to content

Commit

Permalink
naem
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZucker committed May 1, 2024
1 parent a111c32 commit eb32ef7
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions .circleci/create_circleci_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ def to_dict(self):
if test.endswith(".py"):
expanded_tests.append(test)
elif test == "tests/models":
import subprocess
files = glob.glob("tests/models/**/test*.py", recursive=True)
for file in files:
output = subprocess.check_output(['bash', '-c', f"grep -oE 'class[[:space:]]+[[:alnum:]_]+[[:space:]]*\\(' {file} | grep 'Test' | sed -E 's/class[[:space:]]+([[:alnum:]_]+)[[:space:]]*\\(/\1/'"], text=True)
expanded_tests.extend(output.split("\n"))
expanded_tests.extend(glob.glob("tests/models/**/test*.py", recursive=True))
elif test == "tests/pipelines":
expanded_tests.extend([os.path.join(test, x) for x in os.listdir(test)])
else:
Expand All @@ -168,7 +164,7 @@ def to_dict(self):
steps.append({"run": {"name": "Get tests", "command": command}})

# grep -oE "class[[:space:]]+[[:alnum:]_]+[[:space:]]*\(" tests/models/llama/test_modeling_llama.py | grep 'Test' | sed -E 's/class[[:space:]]+([[:alnum:]_]+)[[:space:]]*\(/\1/'
command = 'TESTS=$(circleci tests split tests.txt --split-by=timings --timings-type=classname) && echo $TESTS > splitted_tests.txt'
command = 'TESTS=$(circleci tests split tests.txt --split-by=timings --timings-type=name) && echo $TESTS > splitted_tests.txt'
steps.append({"run": {"name": "Split tests", "command": command}})

steps.append({"store_artifacts": {"path": "tests.txt"}})
Expand Down

0 comments on commit eb32ef7

Please sign in to comment.