Skip to content

Commit 8d3e274

Browse files
authored
Loosen import-time gate on Windows and unpin pytest (#4532)
1 parent 10834d4 commit 8d3e274

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

.github/scripts/build_job_summary.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
The input file is the output of the following command:
44
pytest -vv --durations=0 --durations-min=0.001 > report.txt
55
"""
6+
import re
67
from pathlib import Path
78
import pandas as pd
89
import sys
@@ -20,9 +21,12 @@
2021
start_index = all_lines.index(start_line) + 1
2122

2223
last_index = next(index for index, line in enumerate(all_lines[start_index:]) if "===" in line) + start_index
23-
#last_index = all_lines.index(last_line)
2424

25-
timing_info = all_lines[start_index:last_index]
25+
# Pytest 8.4+ appends a blank line and a "(N durations < Xs hidden.)" footer
26+
# inside the slowest-durations block. Keep only true duration rows shaped like
27+
# "0.123s call test_x.py::test_name".
28+
duration_line_re = re.compile(r"^\d+\.\d+s\s+(call|setup|teardown)\s")
29+
timing_info = [line for line in all_lines[start_index:last_index] if duration_line_re.match(line)]
2630
timing_column = [float(line.split("s")[0].rstrip()) for line in timing_info]
2731
type = [line.split("s")[1].rstrip() for line in timing_info]
2832
short_name = [line.rpartition('::')[2] for line in timing_info]

.github/scripts/import_test.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@
4545
time_taken_list.append(time_taken)
4646

4747
for time in time_taken_list:
48-
import_time_threshold = 3.0 # Most of the times is sub-second but there outliers
48+
# TODO: lower this back toward 3.0 s once the Windows runner outliers are diagnosed.
49+
import_time_threshold = 6.0
4950
if time >= import_time_threshold:
5051
exceptions.append(
5152
f"Importing {import_statement} took: {time:.2f} s. Should be <: {import_time_threshold} s."
5253
)
5354
break
5455

55-
5656
if time_taken_list:
5757
avg_time = sum(time_taken_list) / len(time_taken_list)
5858
std_time = math.sqrt(sum((x - avg_time) ** 2 for x in time_taken_list) / len(time_taken_list))
@@ -65,8 +65,9 @@
6565
f"Importing {import_statement} took: {avg_time:.2f} s in average. Should be <: {import_time_threshold} s."
6666
)
6767

68+
# This is displayed to GITHUB_STEP_SUMMARY. Print it before raising so the
69+
# per-sample table is available even when the average threshold is exceeded.
70+
print(markdown_output)
71+
6872
if exceptions:
6973
raise Exception("\n".join(exceptions))
70-
71-
# This is displayed to GITHUB_STEP_SUMMARY
72-
print(markdown_output)

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ metrics = [
123123

124124
test_core = [
125125
"pandas<3",
126-
"pytest<8.4.0",
126+
"pytest",
127127
"psutil",
128128

129129
# for github test : probeinterface and neo from master
@@ -154,7 +154,7 @@ test_preprocessing = [
154154

155155

156156
test = [
157-
"pytest<8.4.0",
157+
"pytest",
158158
"pytest-cov",
159159
"psutil",
160160

0 commit comments

Comments
 (0)