Skip to content

Commit

Permalink
some testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurZucker committed May 1, 2024
1 parent 55ecc72 commit a111c32
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .circleci/create_circleci_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ def to_dict(self):
)

steps.append({"run": {"name": "Create `test-results` directory", "command": "mkdir test-results"}})

steps.append({"run": {"name": "copy init","command": "cp -f .circleci/resources/pytest_build_config.ini pytest.ini || true"}})
test_command = ""
if self.command_timeout:
test_command = f"timeout {self.command_timeout} "
Expand Down Expand Up @@ -145,7 +143,11 @@ def to_dict(self):
if test.endswith(".py"):
expanded_tests.append(test)
elif test == "tests/models":
expanded_tests.extend(glob.glob("tests/models/**/test*.py", recursive=True))
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"))
elif test == "tests/pipelines":
expanded_tests.extend([os.path.join(test, x) for x in os.listdir(test)])
else:
Expand All @@ -165,6 +167,7 @@ def to_dict(self):
command = f'echo {tests} | tr " " "\\n" >> tests.txt'
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'
steps.append({"run": {"name": "Split tests", "command": command}})

Expand Down

0 comments on commit a111c32

Please sign in to comment.