File: run.py

package info (click to toggle)
mcomix 1.2.1mcomix3+git20200206-1
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 6,604 kB
  • sloc: python: 17,232; xml: 52; sh: 11; makefile: 7
file content (44 lines) | stat: -rwxr-xr-x 1,048 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
38
39
40
41
42
43
44
#!/usr/bin/python2

__requires__ = 'pytest'

import os
import shutil
import sys

from pkg_resources import load_entry_point

if __name__ == '__main__':

    test_dir = os.path.dirname(__file__)

    # Remove __pycache__ directory so pytest does not freak out
    # when switching between the Linux/Windows versions.
    pycache = os.path.join(test_dir, '__pycache__')
    if os.path.exists(pycache):
        shutil.rmtree(pycache)

    custom_testsuite = None
    args = []
    n = 1
    while n < len(sys.argv):
        a = sys.argv[n]
        if '-' == a[0]:
            if '-V' == a:
                n += 1
                os.environ['MCOMIXPATH'] = sys.argv[n]
            else:
                args.append(a)
        elif os.path.exists(a):
            custom_testsuite = a
            args.append(a)
        else:
            args.extend(('-k', a))
        n += 1
    if custom_testsuite is None:
        args.insert(0, test_dir)
    sys.argv[1:] = args

    sys.exit(
        load_entry_point('pytest', 'console_scripts', 'py.test')()
    )