Skip to content

Commit

Permalink
add the possibility to use a config file for specifying servers for t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
damoxc committed Mar 3, 2010
1 parent c1454da commit 10dd3e4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions .bzrignore
@@ -1,3 +1,4 @@
build
_mssql.c
pymssql.c
tests/tests.cfg
26 changes: 21 additions & 5 deletions tests/mssqltests.py
@@ -1,10 +1,26 @@
import unittest
import sys
import _mssql
import unittest
import ConfigParser

_parser = ConfigParser.ConfigParser({
'server': 'localhost',
'username': 'sa',
'password': '',
'database': 'tempdb'
})
_parser.read('tests.cfg')

if sys.argv[1:] and _parser.has_section(sys.argv[1]):
section = sys.argv[1]
else:
section = 'DEFAULT'

server = _parser.get(section, 'server')
username = _parser.get(section, 'username')
password = _parser.get(section, 'password')
database = _parser.get(section, 'database')

server = 'localhost'
username = 'sa'
password = ''
database = 'tempdb'

class MSSQLTestCase(unittest.TestCase):
def setUp(self):
Expand Down

0 comments on commit 10dd3e4

Please sign in to comment.