Skip to content

Commit 2a064d7

Browse files
author
Alexander Smishlajev
committed
use mysql.db_exists() instead of mysql.Database
to test connection availability: mysql.Database requires existing roundup database to connect.
1 parent 3aa9164 commit 2a064d7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/test_mysql.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: test_mysql.py,v 1.12 2004-09-26 11:30:56 a1s Exp $
18+
# $Id: test_mysql.py,v 1.13 2004-09-26 15:18:28 a1s Exp $
1919

2020
import unittest, os, shutil, time, imp
2121

@@ -79,11 +79,11 @@ def test_suite():
7979
return suite
8080

8181
from roundup.backends import mysql
82+
import MySQLdb
8283
try:
83-
# Check if we can run mysql tests
84-
import MySQLdb
85-
db = mysql.Database(config, 'admin')
86-
db.close()
84+
# Check if we can connect to the server.
85+
# use db_exists() to make a connection, ignore it's return value
86+
mysql.db_exists(config)
8787
except (MySQLdb.MySQLError, DatabaseError), msg:
8888
print "Skipping mysql tests (%s)"%msg
8989
else:

0 commit comments

Comments
 (0)