BIND 10 trac2823, updated. 5bdee1a5056c8e3517d2dd3de954d40323027ee1 [2823] use assertIs(Not)None wherever possible

BIND 10 source code commits bind10-changes at lists.isc.org
Mon May 6 22:57:30 UTC 2013


The branch, trac2823 has been updated
       via  5bdee1a5056c8e3517d2dd3de954d40323027ee1 (commit)
       via  034e1d3b1490054f265c4e4ac20cfa43127a5625 (commit)
       via  b308ba3bf71ccc768f302022e7ab571ff2cfbdfd (commit)
       via  72604e2508ea78f0f0fcce74b6e34838e75675a2 (commit)
      from  ac3da26ee0505f828be081d284b4216f5ada820a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5bdee1a5056c8e3517d2dd3de954d40323027ee1
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Mon May 6 15:57:09 2013 -0700

    [2823] use assertIs(Not)None wherever possible

commit 034e1d3b1490054f265c4e4ac20cfa43127a5625
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Mon May 6 15:53:54 2013 -0700

    [2823] clarify the purpose of mock auth statistics spec and data

commit b308ba3bf71ccc768f302022e7ab571ff2cfbdfd
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Mon May 6 10:56:27 2013 -0700

    [2823] avoid hardcoded constant test time data to be compared with local time
    
    it would only pass at the same time zone as that of the original developer.

commit 72604e2508ea78f0f0fcce74b6e34838e75675a2
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Mon May 6 10:45:08 2013 -0700

    [2823] removed a bogus return at the top of a test case
    
    it was a leftover from an intermediate attempt; the test should pass
    without it.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/stats/tests/stats-httpd_test.py |   16 ++++++++--------
 src/bin/stats/tests/stats_test.py       |    1 -
 src/bin/stats/tests/test_utils.py       |   10 ++++++++--
 3 files changed, 16 insertions(+), 11 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/stats/tests/stats-httpd_test.py b/src/bin/stats/tests/stats-httpd_test.py
index 828d9c8..bf33895 100644
--- a/src/bin/stats/tests/stats-httpd_test.py
+++ b/src/bin/stats/tests/stats-httpd_test.py
@@ -628,8 +628,8 @@ class TestStatsHttpd(unittest.TestCase):
         self.assertEqual(self.stats_httpd.running, False)
         self.assertEqual(self.stats_httpd.poll_intval, 0.5)
         self.assertNotEqual(len(self.stats_httpd.httpd), 0)
-        self.assertNotEqual(None, self.stats_httpd.mccs)
-        self.assertNotEqual(None, self.stats_httpd.cc_session)
+        self.assertIsNotNone(self.stats_httpd.mccs)
+        self.assertIsNotNone(self.stats_httpd.cc_session)
         # The real CfgMgr would return 'version', but our test mock omits it,
         # so the len(config) should be 1
         self.assertEqual(len(self.stats_httpd.config), 1)
@@ -655,19 +655,19 @@ class TestStatsHttpd(unittest.TestCase):
         self.stats_httpd.close_mccs()
         self.assertTrue(mccs.stopped)
         self.assertTrue(mccs.closed)
-        self.assertEqual(self.stats_httpd.mccs, None)
+        self.assertIsNone(self.stats_httpd.mccs)
         self.stats_httpd.open_mccs()
         self.assertIsNotNone(self.stats_httpd.mccs)
         self.stats_httpd.mccs = None
-        self.assertEqual(self.stats_httpd.mccs, None)
-        self.assertEqual(self.stats_httpd.close_mccs(), None)
+        self.assertIsNone(self.stats_httpd.mccs)
+        self.assertIsNone(self.stats_httpd.close_mccs())
 
     def test_mccs(self):
         self.stats_httpd = MyStatsHttpd(get_availaddr())
         self.assertIsNotNone(self.stats_httpd.mccs.get_socket())
         self.assertTrue(
             isinstance(self.stats_httpd.mccs.get_socket(), socket.socket))
-        self.assertNotEqual(None, self.stats_httpd.cc_session)
+        self.assertIsNotNone(self.stats_httpd.cc_session)
         statistics_spec = self.stats_httpd.get_stats_spec()
         for mod in DUMMY_DATA:
             self.assertTrue(mod in statistics_spec)
@@ -793,7 +793,7 @@ class TestStatsHttpd(unittest.TestCase):
         select.select = lambda r, w, x, t: self.__faked_select()
         self.stats_httpd.start()
         self.assertFalse(self.stats_httpd.running)
-        self.assertEqual(None, self.stats_httpd.mccs) # stop() clears .mccs
+        self.assertIsNone(self.stats_httpd.mccs) # stop() clears .mccs
 
     def test_running_fail(self):
         # A failure case of start(): we close the (real but dummy) socket for
@@ -820,7 +820,7 @@ class TestStatsHttpd(unittest.TestCase):
         self.stats_httpd = MyStatsHttpd(get_availaddr())
         self.stats_httpd.start() # shouldn't leak the exception
         self.assertFalse(self.stats_httpd.running)
-        self.assertEqual(None, self.stats_httpd.mccs)
+        self.assertIsNone(self.stats_httpd.mccs)
 
     def test_open_template(self):
         self.stats_httpd = MyStatsHttpd(get_availaddr())
diff --git a/src/bin/stats/tests/stats_test.py b/src/bin/stats/tests/stats_test.py
index 3960939..437f0a8 100644
--- a/src/bin/stats/tests/stats_test.py
+++ b/src/bin/stats/tests/stats_test.py
@@ -1407,7 +1407,6 @@ class TestOSEnv(unittest.TestCase):
         test for the environ variable "B10_FROM_SOURCE"
         "B10_FROM_SOURCE" is set in Makefile
         """
-        return
         # test case having B10_FROM_SOURCE
         self.assertTrue("B10_FROM_SOURCE" in os.environ)
         self.assertEqual(stats.SPECFILE_LOCATION, \
diff --git a/src/bin/stats/tests/test_utils.py b/src/bin/stats/tests/test_utils.py
index 6ad9e40..8b45f26 100644
--- a/src/bin/stats/tests/test_utils.py
+++ b/src/bin/stats/tests/test_utils.py
@@ -169,6 +169,10 @@ INIT_SPEC_STR = """\
 }
 """
 
+# Note: this is derived of the spec for the DNS authoritative server, but
+# for the purpose of this test, it's completely irrelevant to DNS.
+# Some statisittics specs do not make sense for practical sense but used
+# just cover various types of statistics data (list, map/dict, etc).
 AUTH_SPEC_STR = """\
 {
   "module_spec": {
@@ -448,7 +452,9 @@ class MyStatsHttpd(stats_httpd.StatsHttpd):
         # stats-httpd tests.  For the purpose of these tests, the content of
         # statistics data is not so important (they don't test whther the
         # counter values are correct, etc), so hardcoding the common case
-        # should suffice.
+        # should suffice.  Note also that some of the statistics values and
+        # specs don't make sense in practice (see also comments on
+        # AUTH_SPEC_STR).
         with open(stats.SPECFILE_LOCATION) as f:
             stat_spec_str = f.read()
         self.__default_spec_answer = {
@@ -466,7 +472,7 @@ class MyStatsHttpd(stats_httpd.StatsHttpd):
                       'lname': 'test-lname',
                       'boot_time':
                           time.strftime('%Y-%m-%dT%H:%M:%SZ', CONST_BASETIME),
-                      'timestamp': 1308759248.0},
+                      'timestamp': time.mktime(CONST_BASETIME)},
             'Auth': {'queries.udp': 4, 'queries.tcp': 6,
                      'queries.perzone': [
                     {'queries.udp': 8, 'queries.tcp': 10,



More information about the bind10-changes mailing list