Skip to content

Commit 58360bd

Browse files
committed
Fix tests
1 parent 6a87dc2 commit 58360bd

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

pyperformance/data-files/benchmarks/MANIFEST

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ richards <local>
7575
richards_super <local>
7676
scimark <local>
7777
spectral_norm <local>
78-
sphinx <local>
78+
sphinx <local>
7979
sqlalchemy_declarative <local>
8080
sqlalchemy_imperative <local>
8181
sqlglot <local>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
sphinx==8.0.2
1+
sphinx==6.2.1
22
python-docs-theme==2024.6

pyperformance/data-files/benchmarks/bm_sphinx/run_benchmark.py

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727

2828
preloaded_files = {}
29-
real_io = set()
3029

3130

3231
def read_all_files():
@@ -61,10 +60,6 @@ def open(
6160
preloaded_files[file] = newfile
6261
return newfile
6362

64-
if isinstance(file, str):
65-
if DOC_ROOT in Path(file).parents:
66-
real_io.add(file)
67-
6863
return _orig_open(
6964
file,
7065
mode=mode,
@@ -88,37 +83,31 @@ def replace(src, dst):
8883

8984

9085
def build_html(doc_root):
91-
sys.argv = [
92-
"sphinx-build",
86+
# Make sure there is no caching going on
87+
if (DOC_ROOT / "build").is_dir():
88+
shutil.rmtree(DOC_ROOT / "build")
89+
90+
args = [
9391
"-b",
9492
"html",
9593
"-d",
9694
str(doc_root / "build" / "doctrees"),
9795
"-j",
9896
"1",
9997
"-Q",
100-
"--fresh-env",
101-
"--write-all",
10298
str(doc_root),
10399
str(doc_root / "build" / "html"),
104100
]
105-
t0 = pyperf.perf_counter()
106-
sphinx_main()
107-
elapsed = pyperf.perf_counter() - t0
108-
109-
for file in real_io:
110-
print(f"Did real I/O for {file}")
111101

112-
return elapsed
102+
t0 = pyperf.perf_counter()
103+
sphinx_main(args)
104+
return pyperf.perf_counter() - t0
113105

114106

115107
def bench_sphinx(loops, doc_root):
116108
runs_total = 0
117109
for _ in range(loops):
118110
runs_total += build_html(doc_root)
119-
120-
print(gc.get_stats())
121-
122111
return runs_total
123112

124113

@@ -134,4 +123,4 @@ def bench_sphinx(loops, doc_root):
134123
shutil.rmtree(DOC_ROOT / "build")
135124
read_all_files()
136125

137-
runner.bench_time_func("docutils", bench_sphinx, DOC_ROOT, inner_loops=1)
126+
runner.bench_time_func("sphinx", bench_sphinx, DOC_ROOT, inner_loops=1)

0 commit comments

Comments
 (0)