Changeset 999687e


Ignore:
Timestamp:
12/06/10 15:25:00 (2 years ago)
Author:
Oleg Batrashev <ogbash@…>
Branches:
master, external, fix-prolong, refactor, refactor-ext, refactor-subsolvers
Children:
ee6f189
Parents:
52a2f01
git-author:
Oleg Batrashev <ogbash@…> (12/06/10 15:25:00)
git-committer:
Oleg Batrashev <ogbash@…> (12/06/10 15:25:00)
Message:

In testcompare script read conf.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/testcompare.py

    r1ac1f40 r999687e  
    33import MySQLdb 
    44import sys 
     5import getopt 
    56import logging 
    67logging.basicConfig() 
     
    89 
    910from doug import testmysql 
     11from doug.config import DOUGConfigParser 
     12 
     13def usage(): 
     14    sys.stderr.write("Usage: %s\n" 
     15                     "\t [--conf=<filename>]...\n" 
     16                     % (sys.argv[0],)) 
     17 
     18 
     19try: 
     20    opts, extra = getopt.getopt(sys.argv[1:], "", ["conf="]) 
     21except getopt.GetoptError: 
     22    usage() 
     23    sys.exit(1) 
     24 
     25if len(extra)>0: 
     26    usage() 
     27    sys.exit(1) 
     28 
     29confFileNames = [] 
     30for opt in opts: 
     31    if opt[0]=="--conf": 
     32        confFileNames.append(opt[1]) 
     33 
     34# config and tar file 
     35conf = DOUGConfigParser() 
     36conf.read(confFileNames) 
     37 
     38host = conf.get("testscript", "mysql-host") 
     39user = conf.get("testscript", "mysql-user") 
     40password = conf.get("testscript", "mysql-password") 
     41database = conf.get("testscript", "mysql-database") 
    1042 
    1143class TestResult: 
     
    93125def login(): 
    94126    global connection 
    95     print "Enter mysql password:" 
    96     password = sys.stdin.readline().strip() 
    97  
    98     connection = MySQLdb.connect('localhost', 'dougtester', password, 'dougtests') 
     127    connection = MySQLdb.connect(host, user, password, database) 
    99128 
    100129login() 
Note: See TracChangeset for help on using the changeset viewer.