summaryrefslogtreecommitdiff
path: root/tests/functional-tests/common/utils/options.py
blob: 7bbfad9c13bc4e81d070ffc1739e6c0fd1d4e775 (plain)
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
from optparse import OptionParser
import sys

usage = "usage: %prog [options]"

parser = OptionParser(usage=usage)

parser.add_option("-m", "--start-manually", dest="startmanually",
                  action="store_true",
                  default=False,
                  help="Wait for an external instance of the processes to appear in the system")

parser.add_option("-v", "--verbose", dest="verbose",
                  action="store_true",
                  default=False,
                  help="Display a log of test process statuses")

(options, args) = parser.parse_args()

# Deleting options from the args. Otherwise unittest and the tests which
# have their own simple commandline parsers will complain
for option in ["--startmanually", "-m", "--verbose", "-v"]:
    try:
        sys.argv.remove(option)
    except ValueError:
        pass


def is_verbose():
    """
    True to log process status information to stdout
    """
    return options.verbose


def is_manual_start():
    """
    False to start the processes automatically
    """
    return options.startmanually