Skip to content

Commit 34bb7fd

Browse files
committed
RUFF fix on CI scripts
Signed-off-by: Yuanyuan Chen <cyyever@outlook.com>
1 parent 549ba5b commit 34bb7fd

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

.circleci/create_circleci_config.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
import argparse
1717
import copy
1818
import os
19-
import random
2019
from dataclasses import dataclass
21-
from typing import Any, Dict, List, Optional
22-
import glob
20+
from typing import Any, Optional
21+
2322
import yaml
2423

2524

@@ -82,15 +81,15 @@ def to_dict(self):
8281
@dataclass
8382
class CircleCIJob:
8483
name: str
85-
additional_env: Dict[str, Any] = None
86-
docker_image: List[Dict[str, str]] = None
87-
install_steps: List[str] = None
84+
additional_env: dict[str, Any] = None
85+
docker_image: list[dict[str, str]] = None
86+
install_steps: list[str] = None
8887
marker: Optional[str] = None
8988
parallelism: Optional[int] = 0
9089
pytest_num_workers: int = 8
91-
pytest_options: Dict[str, Any] = None
90+
pytest_options: dict[str, Any] = None
9291
resource_class: Optional[str] = "xlarge"
93-
tests_to_run: Optional[List[str]] = None
92+
tests_to_run: Optional[list[str]] = None
9493
num_test_files_per_worker: Optional[int] = 10
9594
# This should be only used for doctest job!
9695
command_timeout: Optional[int] = None
@@ -149,7 +148,7 @@ def to_dict(self):
149148
# Examples special case: we need to download NLTK files in advance to avoid cuncurrency issues
150149
timeout_cmd = f"timeout {self.command_timeout} " if self.command_timeout else ""
151150
marker_cmd = f"-m '{self.marker}'" if self.marker is not None else ""
152-
junit_flags = f" -p no:warning -o junit_family=xunit1 --junitxml=test-results/junit.xml"
151+
junit_flags = " -p no:warning -o junit_family=xunit1 --junitxml=test-results/junit.xml"
153152
joined_flaky_patterns = "|".join(FLAKY_TEST_FAILURE_PATTERNS)
154153
repeat_on_failure_flags = f"--reruns 5 --reruns-delay 2 --only-rerun '({joined_flaky_patterns})'"
155154
parallel = f' << pipeline.parameters.{self.job_name}_parallelism >> '
@@ -200,9 +199,9 @@ def to_dict(self):
200199
fi"""
201200
},
202201
},
203-
{"run": {"name": "Expand to show skipped tests", "when": "always", "command": f"python3 .circleci/parse_test_outputs.py --file tests_output.txt --skip"}},
204-
{"run": {"name": "Failed tests: show reasons", "when": "always", "command": f"python3 .circleci/parse_test_outputs.py --file tests_output.txt --fail"}},
205-
{"run": {"name": "Errors", "when": "always", "command": f"python3 .circleci/parse_test_outputs.py --file tests_output.txt --errors"}},
202+
{"run": {"name": "Expand to show skipped tests", "when": "always", "command": "python3 .circleci/parse_test_outputs.py --file tests_output.txt --skip"}},
203+
{"run": {"name": "Failed tests: show reasons", "when": "always", "command": "python3 .circleci/parse_test_outputs.py --file tests_output.txt --fail"}},
204+
{"run": {"name": "Errors", "when": "always", "command": "python3 .circleci/parse_test_outputs.py --file tests_output.txt --errors"}},
206205
{"store_test_results": {"path": "test-results"}},
207206
{"store_artifacts": {"path": "test-results/junit.xml"}},
208207
{"store_artifacts": {"path": "reports"}},

.circleci/parse_test_outputs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import re
21
import argparse
2+
import re
3+
34

45
def parse_pytest_output(file_path):
56
skipped_tests = {}

.github/scripts/assign_reviewers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
import os
17-
import github
1816
import json
19-
from github import Github
17+
import os
2018
import re
2119
from collections import Counter
2220
from pathlib import Path
2321

22+
import github
23+
from github import Github
24+
25+
2426
def pattern_to_regex(pattern):
2527
if pattern.startswith("/"):
2628
start_anchor = True

0 commit comments

Comments
 (0)