File: conf_test.py

package info (click to toggle)
mariadb-connector-python 1.1.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 812 kB
  • sloc: python: 6,246; ansic: 4,971; sh: 23; makefile: 14
file content (30 lines) | stat: -rw-r--r-- 834 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env python -O
# -*- coding: utf-8 -*-

import os


def glob():
    dm = {
        "module": os.environ.get('TEST_MODULE', 'mariadb'),
        }

    return dm


def conf():
    d = {
        "user": os.environ.get('TEST_DB_USER', 'root'),
        "host": os.environ.get('TEST_DB_HOST', 'localhost'),
        "database": os.environ.get('TEST_DB_DATABASE', 'testp'),
        "port": int(os.environ.get('TEST_DB_PORT', '3306')),
    }
    if os.environ.get('TEST_REQUIRE_TLS'):
        if os.environ.get('TEST_REQUIRE_TLS') == "1":
            d["ssl"] = True
    if os.environ.get('TEST_RESET_SESSION'):
        reset = int(os.environ.get('TEST_RESET_SESSION', '1'))
        d["pool_reset_connection"] = reset
    if os.environ.get('TEST_DB_PASSWORD'):
        d["password"] = os.environ.get('TEST_DB_PASSWORD')
    return d