CI: separate step to download nltk files (#32935)

* separate step to download nltk files

* duplicated

* rm comma
This commit is contained in:
Joao Gante 2024-08-22 14:17:24 +01:00 committed by GitHub
parent c42d264549
commit 8b94d28f97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -121,11 +121,16 @@ class CircleCIJob:
)
steps.append({"run": {"name": "Create `test-results` directory", "command": "mkdir test-results"}})
# Examples special case: we need to download NLTK files in advance to avoid cuncurrency issues
if "examples" in self.name:
steps.append({"run": {"name": "Download NLTK files", "command": """python -c "import nltk; nltk.download('punkt', quiet=True)" """}})
test_command = ""
if self.command_timeout:
test_command = f"timeout {self.command_timeout} "
# junit familiy xunit1 is necessary to support splitting on test name or class name with circleci split
test_command += f"python3 -m pytest -rsfE -p no:warnings -o junit_family=xunit1 --tb=short --junitxml=test-results/junit.xml -n {self.pytest_num_workers} " + " ".join(pytest_flags)
test_command += f"python3 -m pytest -rsfE -p no:warnings --tb=short -o junit_family=xunit1 --junitxml=test-results/junit.xml -n {self.pytest_num_workers} " + " ".join(pytest_flags)
if self.parallelism == 1:
if self.tests_to_run is None:
@ -185,10 +190,6 @@ class CircleCIJob:
steps.append({"store_artifacts": {"path": "tests.txt"}})
steps.append({"store_artifacts": {"path": "splitted_tests.txt"}})
test_command = ""
if self.command_timeout:
test_command = f"timeout {self.command_timeout} "
test_command += f"python3 -m pytest -rsfE -p no:warnings --tb=short -o junit_family=xunit1 --junitxml=test-results/junit.xml -n {self.pytest_num_workers} " + " ".join(pytest_flags)
test_command += " $(cat splitted_tests.txt)"
if self.marker is not None:
test_command += f" -m {self.marker}"