summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2007-01-15 12:33:06 +0100
committerAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2007-01-15 12:33:06 +0100
commite10ff3cb0119604fe1934314c62ba57d8816b6b6 (patch)
tree9ad291c76ca00532ebe8445a0598693899f36683
parent39ae2667173b691c201f753cd31dd8117de2300f (diff)
downloadlogilab-common-e10ff3cb0119604fe1934314c62ba57d8816b6b6.tar.gz
fix MySQL tests and behaviour when host is None
-rw-r--r--db.py2
-rw-r--r--fileutils.py12
-rw-r--r--test/unittest_db.py2
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'