~ubuntu-branches/debian/sid/pytds/sid

« back to all changes in this revision

Viewing changes to tests/settings.py

  • Committer: Package Import Robot
  • Author(s): Christopher Hoskin
  • Date: 2017-03-11 20:12:33 UTC
  • Revision ID: package-import@ubuntu.com-20170311201233-voewiramv2n5i4uj
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import os
 
2
 
 
3
CONNECT_ARGS = []
 
4
CONNECT_KWARGS = {}
 
5
 
 
6
LIVE_TEST = 'HOST' in os.environ
 
7
if LIVE_TEST:
 
8
    HOST = os.environ['HOST']
 
9
    DATABASE=os.environ['DATABASE']
 
10
    USER=os.environ['SQLUSER']
 
11
    PASSWORD=os.environ['SQLPASSWORD']
 
12
    USE_MARS = bool(os.environ.get('USE_MARS', True))
 
13
    SKIP_SQL_AUTH = bool(os.environ.get('SKIP_SQL_AUTH'))
 
14
 
 
15
    import pytds
 
16
 
 
17
    CONNECT_KWARGS = {
 
18
            'server': HOST,
 
19
            'database': DATABASE,
 
20
            'user': USER,
 
21
            'password': PASSWORD,
 
22
            'use_mars': USE_MARS,
 
23
            'bytes_to_unicode': True,
 
24
            }
 
25
 
 
26
    if 'tds_version' in os.environ:
 
27
        CONNECT_KWARGS['tds_version'] = getattr(pytds, os.environ['tds_version'])
 
28
 
 
29
    if 'auth' in os.environ:
 
30
        import pytds.login
 
31
        CONNECT_KWARGS['auth'] = getattr(pytds.login, os.environ['auth'])()
 
32
 
 
33
    if 'bytes_to_unicode' in os.environ:
 
34
        CONNECT_KWARGS['bytes_to_unicode'] = bool(os.environ.get('bytes_to_unicode'))