summaryrefslogtreecommitdiffstats
path: root/test/__init__.py
blob: b00eb235d7d74592788f3117a7a50fafc92fa227 (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
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of libgfapi-python project which is a
# subproject of GlusterFS ( www.gluster.org)
#
# This file is licensed to you under your choice of the GNU Lesser
# General Public License, version 3 or any later version (LGPLv3 or
# later), or the GNU General Public License, version 2 (GPLv2), in all
# cases as published by the Free Software Foundation.

import os
import ConfigParser


def get_test_config():
    """
    Reads test.conf config file which contains configurable options
    to run functional tests.

    :returns: ConfigParser instance if test.conf found, None otherwise.
    """
    dirname = os.path.dirname(__file__)
    conf_file = dirname + "/test.conf"
    if os.path.exists(conf_file):
        config = ConfigParser.ConfigParser()
        config.read(conf_file)
        return config
    return None