From e10ff3cb0119604fe1934314c62ba57d8816b6b6 Mon Sep 17 00:00:00 2001 From: Adrien Di Mascio Date: Mon, 15 Jan 2007 12:33:06 +0100 Subject: fix MySQL tests and behaviour when host is None --- db.py | 2 +- fileutils.py | 12 ++++++++++++ test/unittest_db.py | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/db.py b/db.py index 604da80..d839fe9 100644 --- a/db.py +++ b/db.py @@ -383,7 +383,7 @@ class _MySqlDBAdapter(DBAPIAdapter): the unicode named argument asks to use Unicode objects for strings in result sets and query parameters """ - kwargs = {'host' : host, 'db' : database, + kwargs = {'host' : host or '', 'db' : database, 'user' : user, 'passwd' : password, 'use_unicode' : unicode} if port: diff --git a/fileutils.py b/fileutils.py index 7566a11..9ede37a 100644 --- a/fileutils.py +++ b/fileutils.py @@ -28,6 +28,7 @@ import sys import shutil import mimetypes from os.path import isabs, isdir, islink, split, exists, walk, normpath, join +from os.path import abspath from os import sep, mkdir, remove, listdir, stat, chmod from stat import ST_MODE, S_IWRITE from cStringIO import StringIO @@ -60,7 +61,18 @@ def first_level_directory(path): # path was absolute, head is the fs root return head +def abspath_listdir(path): + """lists path's content using absolute paths + >>> os.listdir('/home') + ['adim', 'alf', 'arthur', 'auc'] + >>> abspath_listdir('/home') + ['/home/adim', '/home/alf', '/home/arthur', '/home/auc'] + """ + path = abspath(path) + return [join(path, filename) for filename in listdir(path)] + + def is_binary(filename): """return true if filename may be a binary file, according to it's extension diff --git a/test/unittest_db.py b/test/unittest_db.py index c361e43..fe701f9 100644 --- a/test/unittest_db.py +++ b/test/unittest_db.py @@ -48,7 +48,7 @@ class PreferedDriverTC(TestCase): class getCnxTC(TestCase): def setUp(self): - self.host = 'crater.logilab.fr' + self.host = None # 'crater.logilab.fr' self.db = 'template1' self.user = 'adim' self.passwd = 'adim' -- cgit v1.2.1