sources for defaultconftest.py [rev. 38799]
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import py
Module = py.test.collect.Module
DoctestFile = py.test.collect.DoctestFile
Directory = py.test.collect.Directory
Class = py.test.collect.Class
Generator = py.test.collect.Generator
Function = py.test.collect.Function
Instance = py.test.collect.Instance
conf_iocapture = "fd" # overridable from conftest.py 
# ===================================================
# Distributed testing specific options 
#dist_hosts: needs to be provided by user
#dist_rsync_roots: might be provided by user, if not present or None,
#                  whole pkgdir will be rsynced
dist_remotepython = "python"
dist_taskspernode = 15
dist_boxed = False
if hasattr(py.std.os, 'nice'):
    dist_nicelevel = py.std.os.nice(0) # nice py.test works
else:
    dist_nicelevel = 0
dist_rsync_ignore = []
# ===================================================
def adddefaultoptions(config):
    Option = config.Option 
    config._addoptions('general options',
        Option('-v', '--verbose',
               action="count", dest="verbose", default=0,
               help="increase verbosity."),
        Option('-x', '--exitfirst',
               action="store_true", dest="exitfirst", default=False,
               help="exit instantly on first error or failed test."),
        Option('-s', '--nocapture',
               action="store_true", dest="nocapture", default=False,
               help="disable catching of sys.stdout/stderr output."),
        Option('-k',
               action="store", dest="keyword", default='',
               help="only run test items matching the given (google-style) "
                    "keyword expression."),
        Option('-l', '--showlocals',
               action="store_true", dest="showlocals", default=False,
               help="show locals in tracebacks (disabled by default)."),
        Option('', '--pdb',
               action="store_true", dest="usepdb", default=False,
               help="start pdb (the Python debugger) on errors."),
        Option('', '--tb',
               action="store", dest="tbstyle", default='long',
               type="choice", choices=['long', 'short', 'no'],
               help="traceback verboseness (long/short/no)."),
        Option('', '--fulltrace',
               action="store_true", dest="fulltrace", default=False,
               help="don't cut any tracebacks (default is to cut)."),
        Option('', '--nomagic',
               action="store_true", dest="nomagic", default=False,
               help="refrain from using magic as much as possible."),
        Option('', '--collectonly',
               action="store_true", dest="collectonly", default=False,
               help="only collect tests, don't execute them."),
        Option('', '--traceconfig',
               action="store_true", dest="traceconfig", default=False,
               help="trace considerations of conftest.py files."),
        Option('-f', '--looponfailing',
               action="store_true", dest="looponfailing", default=False,
               help="loop on failing test set."),
        Option('', '--exec',
               action="store", dest="executable", default=None,
               help="python executable to run the tests with."),
    )
    config._addoptions('EXPERIMENTAL options',
        Option('-d', '--dist',
               action="store_true", dest="dist", default=False,
               help="ad-hoc distribute tests across machines (requires conftest settings)"), 
        Option('-w', '--startserver',
               action="store_true", dest="startserver", default=False,
               help="starts local web server for displaying test progress.", 
               ),
        Option('-r', '--runbrowser',
               action="store_true", dest="runbrowser", default=False,
               help="run browser (implies --startserver)."
               ),
        Option('', '--boxed',
               action="store_true", dest="boxed", default=False,
               help="box each test run in a separate process"), 
        Option('', '--rest',
               action='store_true', dest="restreport", default=False,
               help="restructured text output reporting."),
        Option('', '--apigen',
               action="store", dest="apigen",
               help="generate api documentation while testing (requires "
               "argument pointing to a script)."),
        Option('', '--session',
               action="store", dest="session", default=None,
               help="lookup given sessioname in conftest.py files and use it."), 
    )