Browse Source

[trac1010] use path_search for spec file in test

Jelte Jansen 14 years ago
parent
commit
d867ca0fab

+ 1 - 0
src/lib/python/isc/config/tests/Makefile.am

@@ -14,6 +14,7 @@ endif
 	for pytest in $(PYTESTS) ; do \
 	echo Running test: $$pytest ; \
 	env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python \
+	B10_TEST_PLUGIN_DIR=$(abs_top_srcdir)/src/bin/cfgmgr/plugins \
 	CONFIG_TESTDATA_PATH=$(abs_top_srcdir)/src/lib/config/tests/testdata \
 	CONFIG_WR_TESTDATA_PATH=$(abs_top_builddir)/src/lib/config/tests/testdata \
 	$(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \

+ 3 - 4
src/lib/python/isc/config/tests/ccsession_test.py

@@ -22,9 +22,7 @@ import os
 from isc.config.ccsession import *
 from isc.config.config_data import BIND10_CONFIG_DATA_VERSION
 from unittest_fakesession import FakeModuleCCSession, WouldBlockForever
-
-# Is this test ever called outside of this directory?
-LOGGING_SPEC_FILE = "../../../../../bin/cfgmgr/plugins/logging.spec"
+import bind10_config
 
 class TestHelperFunctions(unittest.TestCase):
     def test_parse_answer(self):
@@ -616,7 +614,8 @@ class TestModuleCCSession(unittest.TestCase):
         self.assertRaises(TypeError, default_logconfig_handler);
         self.assertRaises(TypeError, default_logconfig_handler, 1);
 
-        spec = isc.config.module_spec_from_file(LOGGING_SPEC_FILE)
+        spec = isc.config.module_spec_from_file(
+            path_search('logging.spec', bind10_config.PLUGIN_PATHS))
         config_data = ConfigData(spec)
 
         self.assertRaises(TypeError, default_logconfig_handler, 1, config_data)

+ 1 - 0
src/lib/python/isc/log/tests/Makefile.am

@@ -23,5 +23,6 @@ endif
 	echo Running test: $$pytest ; \
 	$(LIBRARY_PATH_PLACEHOLDER) \
 	env PYTHONPATH=$(abs_top_srcdir)/src/lib/python:$(abs_top_builddir)/src/lib/python:$(abs_top_builddir)/src/lib/python/isc/log:$(abs_top_builddir)/src/lib/log/python/.libs \
+	B10_TEST_PLUGIN_DIR=$(abs_top_srcdir)/src/bin/cfgmgr/plugins \
 	$(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \
 	done

+ 3 - 2
src/lib/python/isc/log/tests/log_test.py

@@ -16,6 +16,8 @@
 # This tests it can be loaded, nothing more yet
 import isc.log
 import unittest
+import bind10_config
+from isc.config.ccsession import path_search
 
 class LogDict(unittest.TestCase):
     def setUp(self):
@@ -53,8 +55,7 @@ class Manager(unittest.TestCase):
         isc.log.init("root", "INFO", 0, "/no/such/file");
 
     def test_log_config_update(self):
-        LOGGING_SPEC_FILE = "../../../../../bin/cfgmgr/plugins/logging.spec"
-        log_spec = isc.config.module_spec_from_file(LOGGING_SPEC_FILE).get_full_spec()
+        log_spec = isc.config.module_spec_from_file(path_search('logging.spec', bind10_config.PLUGIN_PATHS)).get_full_spec()
 
         self.assertRaises(TypeError, isc.log.log_config_update)
         self.assertRaises(TypeError, isc.log.log_config_update, 1)