Skip to content

Commit 3a83e41

Browse files
committed
test(benchmark): more projects, and results collected at end.
1 parent 93e6fa1 commit 3a83e41

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

lab/benchmark.py

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,13 @@ def run_tox(self, env, toxenv, toxargs=""):
153153
def run_no_coverage(self, env):
154154
return self.run_tox(env, env.pyver.toxenv, "--skip-pkg-install")
155155

156+
def run_with_coverage(self, env, pip_args, cov_options):
157+
self.run_tox(env, env.pyver.toxenv, "--notest")
158+
env.shell.run_command(f".tox/{env.pyver.toxenv}/bin/python -m pip install {pip_args}")
159+
return self.run_tox(env, env.pyver.toxenv, "--skip-pkg-install")
156160

157-
class PytestHtml(ToxProject):
161+
162+
class ProjectPytestHtml(ToxProject):
158163
"""pytest-dev/pytest-html"""
159164

160165
git_url = "https://github.com/pytest-dev/pytest-html"
@@ -172,6 +177,22 @@ def run_with_coverage(self, env, pip_args, cov_options):
172177
env.shell.run_command(f".tox/{covenv}/bin/python -m coverage debug sys")
173178
return self.run_tox(env, covenv, "--skip-pkg-install")
174179

180+
class ProjectDateutil(ToxProject):
181+
"""dateutil/dateutil"""
182+
183+
git_url = "https://github.com/dateutil/dateutil"
184+
185+
def prep_environment(self, env):
186+
super().prep_environment(env)
187+
env.shell.run_command(f"{env.python} updatezinfo.py")
188+
189+
def run_no_coverage(self, env):
190+
env.shell.run_command("echo No option to run without coverage")
191+
return 0
192+
193+
class ProjectAttrs(ToxProject):
194+
git_url = "https://github.com/python-attrs/attrs"
195+
175196

176197
class PyVersion:
177198
# The command to run this Python
@@ -213,6 +234,7 @@ def run_experiments(
213234
):
214235
"""Run test suites under different conditions."""
215236

237+
results = []
216238
for proj in projects:
217239
print(f"Testing with {proj.git_url}")
218240
with ShellSession(f"output_{proj.slug}.log") as shell:
@@ -242,9 +264,13 @@ def run_experiments(
242264
print(f"Tests took {dur:.3f}s")
243265
durations.append(dur)
244266
med = statistics.median(durations)
245-
print(
246-
f"## Median for {pyver.command}, cov={cov_slug}: {med:.3f}s"
247-
)
267+
result = f"Median for {proj.slug}, {pyver.command}, cov={cov_slug}: {med:.3f}s"
268+
print(f"## {result}")
269+
results.append(result)
270+
271+
print("# Results")
272+
for result in results:
273+
print(result)
248274

249275

250276
PERF_DIR = Path("/tmp/covperf")
@@ -261,12 +287,13 @@ def run_experiments(
261287
Python(3, 10),
262288
],
263289
cov_versions=[
264-
("none", None, None),
290+
#("none", None, None),
265291
("6.4", "coverage==6.4", ""),
266292
("tip", "-e ~/coverage/trunk", ""),
267293
],
268294
projects=[
269-
PytestHtml(),
295+
ProjectPytestHtml(),
296+
ProjectAttrs(),
270297
],
271298
num_runs=5,
272299
)
@@ -285,7 +312,7 @@ def run_experiments(
285312
# ),
286313
# ],
287314
# projects=[
288-
# PytestHtml(),
315+
# ProjectPytestHtml(),
289316
# ],
290317
# num_runs=3,
291318
# )

0 commit comments

Comments
 (0)