| 1 |
|
| 2 |
""" |
| 3 |
Benchmarks |
| 4 |
~~~~~~~~~~ |
| 5 |
|
| 6 |
""" |
| 7 |
|
| 8 |
import invoke as _invoke |
| 9 |
|
| 10 |
|
| 11 |
@_invoke.task(default=True) |
| 12 |
def tox(ctx, rebuild=False, env=None): |
| 13 |
""" |
| 14 |
Run the benchmarks using tox |
| 15 |
|
| 16 |
:Parameters: |
| 17 |
`rebuild` : ``bool`` |
| 18 |
Rebuild the tox environments? |
| 19 |
|
| 20 |
`env` : ``str`` |
| 21 |
Run this one environment only. |
| 22 |
""" |
| 23 |
tox = ctx.shell.frompath("tox") |
| 24 |
if tox is None: |
| 25 |
raise RuntimeError("tox not found") |
| 26 |
|
| 27 |
command = r""" %s -c bench/tox.ini """ |
| 28 |
args = [tox] |
| 29 |
if rebuild: |
| 30 |
command += " -r" |
| 31 |
if env is not None: |
| 32 |
command += " -e %s" |
| 33 |
args.append(env) |
| 34 |
|
| 35 |
with ctx.shell.root_dir(): |
| 36 |
ctx.run(ctx.c(command, *args), echo=True) |