diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2022-06-11 16:15:15 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-06-11 16:15:15 -0400 |
commit | 7cd57dc22d7a101f0d14972b300dcdf1d9b2fd73 (patch) | |
tree | 0c8f58a015abb6b8d762bee35ea98fe8516a7d20 /lab | |
parent | 0b749007e4fdaac161b201963df1e801352e6274 (diff) | |
download | python-coveragepy-git-7cd57dc22d7a101f0d14972b300dcdf1d9b2fd73.tar.gz |
test: easier ways to get specific coverage versions
Diffstat (limited to 'lab')
-rw-r--r-- | lab/benchmark.py | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/lab/benchmark.py b/lab/benchmark.py index 8e340562..e0da7638 100644 --- a/lab/benchmark.py +++ b/lab/benchmark.py @@ -306,6 +306,25 @@ class CoveragePR(Coverage): options=options, ) +class CoverageCommit(Coverage): + """A version of coverage.py from a specific commit.""" + def __init__(self, sha, options=None): + super().__init__( + slug=sha, + pip_args=f"git+https://github.com/nedbat/coveragepy.git@{sha}", + options=options, + ) + +class CoverageSource(Coverage): + """The coverage.py in a working tree.""" + def __init__(self, directory, options=None): + super().__init__( + slug="source", + pip_args=directory, + options=options, + ) + + @dataclasses.dataclass class Env: """An environment to run a test suite in.""" @@ -416,7 +435,7 @@ class Experiment: col_data[col] = result_time for _, num, denom in ratios: ratio = col_data[num] / col_data[denom] - row.append(f"{int(ratio * 100):d}%") + row.append(f"{ratio * 100:.2f}%") print(as_table_row(row)) @@ -434,6 +453,29 @@ with change_dir(PERF_DIR): Python(3, 11), ], cov_versions=[ + CoverageCommit("0b749007"), + CoverageSource("~/coverage/trunk"), + ], + projects=[ + AdHocProject("/src/bugs/bug1339/bug1339.py"), + SlipcoverBenchmark("bm_sudoku.py"), + SlipcoverBenchmark("bm_spectral_norm.py"), + ], + ) + exp.run(num_runs=31) + exp.show_results( + rows=["pyver", "proj"], + column="cov", + ratios=[ + ("compare", "source", "0b749007"), + ], + ) + if 0: + exp = Experiment( + py_versions=[ + Python(3, 11), + ], + cov_versions=[ Coverage("6.4.1", "coverage==6.4.1"), CoveragePR(1394), ], |