File: SConscript

package info (click to toggle)
rmlint 2.10.2-0.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,180 kB
  • sloc: ansic: 15,671; python: 9,312; sh: 474; xml: 111; makefile: 72
file content (37 lines) | stat: -rw-r--r-- 826 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
37
#!/usr/bin/env python
# encoding: utf-8

Import('env')
Import('programs')


import os
import subprocess


def cmd_exists(cmd):
    return any(
        os.access(os.path.join(path, cmd), os.X_OK)
        for path in os.environ["PATH"].split(os.pathsep)
    )


def run_tests(target=None, source=None, env=None):
    names = ["pytest"]
    exes = [exe for exe in names if cmd_exists(exe)]
    if any(exes):
        name = exes[0]
        print('Found pytest as "{}"'.format(name))
        Exit(subprocess.call(name + ' -s -v -k "not slow"', shell=True))

    print('Unable to find pytest, tried these: ' + str(names))
    Exit(-1)


if 'test' in COMMAND_LINE_TARGETS:
    env.Alias('test',
        env.Depends(
            env.Command('run_tests', None, Action(run_tests, "Running tests")),
            programs
        )
    )