File: test.py

package info (click to toggle)
python-rcssmin 1%3A1.1.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,196 kB
  • sloc: python: 2,379; ansic: 1,216; sh: 110; makefile: 20
file content (53 lines) | stat: -rw-r--r-- 1,217 bytes parent folder | download | duplicates (4)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- encoding: ascii -*-
"""
Test suite tasks
~~~~~~~~~~~~~~~~

"""

import invoke as _invoke


@_invoke.task()
def local(ctx):
    """ Run the test suite using py.test """
    tester = ctx.shell.frompath('py.test')
    if tester is None:
        raise RuntimeError("py.test not found")

    with ctx.shell.root_dir():
        command = r'''
            %s -c test.ini -vv -s
            --doctest-modules
            --color=yes
            --exitfirst
        '''
        args = [tester]

        for ignored in ctx.test.ignore:
            command += ' --ignore %s'
            args.append(ignored)

        command += ' %s'
        args.append('tests')

        ctx.run(ctx.c(command, *args), echo=True)


@_invoke.task(default=True)
def tox(ctx, rebuild=False, env=None):
    """ Run the test suite using tox """
    tox = ctx.shell.frompath('tox')  # pylint: disable = redefined-outer-name
    if tox is None:
        raise RuntimeError("tox not found")

    command = r''' %s -c test.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)