File: benchmark.py

package info (click to toggle)
python-rjsmin 1.2.5%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,256 kB
  • sloc: javascript: 8,503; python: 5,315; ansic: 821; sh: 100; makefile: 19
file content (36 lines) | stat: -rw-r--r-- 747 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: ascii -*-
"""
Benchmarks
~~~~~~~~~~

"""

import invoke as _invoke


@_invoke.task(default=True)
def tox(ctx, rebuild=False, env=None):
    """
    Run the benchmarks using tox

    :Parameters:
      `rebuild` : ``bool``
        Rebuild the tox environments?

      `env` : ``str``
        Run this one environment only.
    """
    tox = ctx.shell.frompath("tox")  # pylint: disable = redefined-outer-name
    if tox is None:
        raise RuntimeError("tox not found")

    command = r""" %s -c bench/tox.ini """
    args = [tox]
    if rebuild:
        command += " -r"
    if env is not None:
        command += " -e %s"
        args.append(env)

    with ctx.shell.root_dir():
        ctx.run(ctx.c(command, *args), echo=True)