]> err.no Git - dak/commitdiff
Use a custom dak.conf during tests - now we can import daklib.utils.
authorChris Lamb <lamby@debian.org>
Sat, 31 Oct 2009 13:53:11 +0000 (13:53 +0000)
committerChris Lamb <lamby@debian.org>
Sat, 31 Oct 2009 23:01:55 +0000 (23:01 +0000)
Signed-off-by: Chris Lamb <lamby@debian.org>
daklib/utils.py
tests/base_test.py
tests/fixtures/dak.conf [new file with mode: 0644]

index 05287483a52147ed19fac447fd7b2a8393f43ef5..1fc1d4773110bc579f4c2b53e83e12f1b3c02f48 100644 (file)
@@ -1504,7 +1504,8 @@ def get_changes_files(from_dir):
 apt_pkg.init()
 
 Cnf = apt_pkg.newConfiguration()
-apt_pkg.ReadConfigFileISC(Cnf,default_config)
+if not os.getenv("DAK_TEST"):
+    apt_pkg.ReadConfigFileISC(Cnf,default_config)
 
 if which_conf_file() != default_config:
     apt_pkg.ReadConfigFileISC(Cnf,which_conf_file())
index b116e49898165ed9e506837c2608cfd794fae941..255e71b001a537e94be3d73609f152ce69d3f785 100644 (file)
@@ -1,13 +1,18 @@
+import os
 import sys
 import unittest
 
 from os.path import abspath, dirname, join
 
 DAK_ROOT_DIR = dirname(dirname(abspath(__file__)))
+DAK_TEST_FIXTURES = join(DAK_ROOT_DIR, 'tests', 'fixtures')
 
 class DakTestCase(unittest.TestCase):
     def setUp(self):
         pass
 
+os.environ['DAK_TEST'] = '1'
+os.environ['DAK_CONFIG'] = join(DAK_TEST_FIXTURES, 'dak.conf')
+
 if DAK_ROOT_DIR not in sys.path:
     sys.path.insert(0, DAK_ROOT_DIR)
diff --git a/tests/fixtures/dak.conf b/tests/fixtures/dak.conf
new file mode 100644 (file)
index 0000000..e69de29