From 682635f59f5271a071418e1eb6ccf0c3b3247c28 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Sat, 31 Oct 2009 13:53:11 +0000 Subject: [PATCH] Use a custom dak.conf during tests - now we can import daklib.utils. Signed-off-by: Chris Lamb --- daklib/utils.py | 3 ++- tests/base_test.py | 5 +++++ tests/fixtures/dak.conf | 0 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/dak.conf diff --git a/daklib/utils.py b/daklib/utils.py index 05287483..1fc1d477 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -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()) diff --git a/tests/base_test.py b/tests/base_test.py index b116e498..255e71b0 100644 --- a/tests/base_test.py +++ b/tests/base_test.py @@ -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 index 00000000..e69de29b -- 2.39.2