From: Naoki Kambe Date: Mon, 26 Nov 2012 08:09:16 +0000 (+0900) Subject: [2225_statistics] rename class name and add TEST_SPECFILE_LOCATION X-Git-Tag: bind10-1.1.0beta1-release~72^2~40^2~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f29fad03bb3c9885d0bcf84d39102e6ee902830;p=thirdparty%2Fkea.git [2225_statistics] rename class name and add TEST_SPECFILE_LOCATION --- diff --git a/src/lib/python/isc/statistics/tests/Makefile.am b/src/lib/python/isc/statistics/tests/Makefile.am index 24acf17589..92548dd03f 100644 --- a/src/lib/python/isc/statistics/tests/Makefile.am +++ b/src/lib/python/isc/statistics/tests/Makefile.am @@ -27,5 +27,6 @@ endif PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/xfrout:$(abs_top_builddir)/src/bin/xfrin:$(abs_top_builddir)/src/lib/dns/python/.libs \ $(LIBRARY_PATH_PLACEHOLDER) \ B10_FROM_BUILD=$(abs_top_builddir) \ + TESTDATASRCDIR=$(abs_top_srcdir)/src/lib/python/isc/statistics/tests/testdata \ $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ done diff --git a/src/lib/python/isc/statistics/tests/counter_test.py b/src/lib/python/isc/statistics/tests/counter_test.py index 5f7b1401bb..dee5287e6c 100644 --- a/src/lib/python/isc/statistics/tests/counter_test.py +++ b/src/lib/python/isc/statistics/tests/counter_test.py @@ -18,9 +18,11 @@ import unittest import threading from datetime import timedelta +import os import isc.config TEST_ZONE_NAME_STR = "example.com." +TESTDATA_SRCDIR = os.getenv("TESTDATASRCDIR") from isc.statistics import counter @@ -43,9 +45,11 @@ def start_functor(number, cycle, functor, *args): event.set() for th in threads: th.join() -class TestCounter(unittest.TestCase): +class TestBasicMethods(unittest.TestCase): + TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec1.spec' + def setUp(self): - self.counter = counter.Counter() + self.counter = counter.init(self.TEST_SPECFILE_LOCATION) self._statistics_data = {} self._start_time = {} self._counter_name = "counter" @@ -309,5 +313,14 @@ class BaseTestCounter(): 'socket/%s/tcp/%s' % counter_name, 2) self.check_dump_statistics() +class TestCounter1(BaseTestCounter, unittest.TestCase): + TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec1.spec' + +class TestCounter2(BaseTestCounter, unittest.TestCase): + TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec2.spec' + +class TestCounter3(BaseTestCounter, unittest.TestCase): + TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec3.spec' + if __name__== "__main__": unittest.main()