BIND 10 trac2297, updated. 29047b54a17c2bc1d27096ea21522e928b51989f [2297] minor correction to the get_uptime_desc() docstring

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Oct 25 03:40:58 UTC 2012


The branch, trac2297 has been updated
       via  29047b54a17c2bc1d27096ea21522e928b51989f (commit)
       via  dbabdcc3c8c103a56a6da5187a97f2748adfa467 (commit)
      from  7eb5518a386019fd723fb2484eb40f13ff283515 (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 29047b54a17c2bc1d27096ea21522e928b51989f
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Oct 24 20:40:35 2012 -0700

    [2297] minor correction to the get_uptime_desc() docstring

commit dbabdcc3c8c103a56a6da5187a97f2748adfa467
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Wed Oct 24 20:39:40 2012 -0700

    [2297] added one more test case for get_uptime_desc

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

Summary of changes:
 src/lib/python/isc/sysinfo/sysinfo.py            |    2 +-
 src/lib/python/isc/sysinfo/tests/sysinfo_test.py |   18 +++++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/sysinfo/sysinfo.py b/src/lib/python/isc/sysinfo/sysinfo.py
index 2b35047..e527cbe 100644
--- a/src/lib/python/isc/sysinfo/sysinfo.py
+++ b/src/lib/python/isc/sysinfo/sysinfo.py
@@ -97,7 +97,7 @@ class SysInfo:
     def get_uptime_desc(self):
         """Returns the uptime in human readable form.
 
-        Specifically, the format is '[DD day[s],] hh:mm'.
+        Specifically, the format is '[DD day[s], ]hh:mm'.
         It returns None if _uptime is None.
 
         """
diff --git a/src/lib/python/isc/sysinfo/tests/sysinfo_test.py b/src/lib/python/isc/sysinfo/tests/sysinfo_test.py
index d08d6dd..aeeee15 100644
--- a/src/lib/python/isc/sysinfo/tests/sysinfo_test.py
+++ b/src/lib/python/isc/sysinfo/tests/sysinfo_test.py
@@ -171,11 +171,14 @@ def _my_freebsd_os_sysconf(key):
 def _my_freebsd_platform_uname():
     return ('FreeBSD', 'freebsd', '8.2-RELEASE', '', 'i386')
 
-def _my_freebsd_osx_subprocess_check_output(command):
+def _my_freebsd_osx_subprocess_check_output(command, faked_output={}):
     '''subprocess output shared for freebsd and osx'''
     assert type(command) == list, 'command argument is not a list'
     if command == ['sysctl', '-n', 'kern.boottime']:
-        return bytes('{ sec = ' + str(int(time.time() - 76632)) + ', usec = 0 }\n', 'utf-8')
+        if 'boottime-sysctl' in faked_output:
+            return faked_output['boottime-sysctl']
+        return bytes('{ sec = ' + str(int(time.time() - 76632)) +
+                     ', usec = 0 }\n', 'utf-8')
     elif command == ['sysctl', '-n', 'vm.loadavg']:
         return b'{ 0.2 0.4 0.6 }\n'
     else:
@@ -193,7 +196,8 @@ def _my_freebsd_subprocess_check_output(command, faked_output):
     elif command == ['swapctl', '-s', '-k']:
         return b'Total:         1013216    0\n'
     else:
-        freebsd_osx_output = _my_freebsd_osx_subprocess_check_output(command)
+        freebsd_osx_output = \
+            _my_freebsd_osx_subprocess_check_output(command, faked_output)
         if freebsd_osx_output is not None:
             return freebsd_osx_output
         else:
@@ -431,6 +435,14 @@ class SysInfoTest(unittest.TestCase):
         self.assertEqual(1037533184, s.get_mem_swap_total())
         self.assertEqual(1037533184, s.get_mem_swap_free())
 
+        # One more untested case so far: get_uptime_desc() should omit the
+        # "days" field.
+        faked_process_output['boottime-sysctl'] = bytes(
+            '{ sec = ' + str(int(time.time() - 4200)) +
+                     ', usec = 0 }\n', 'utf-8')
+        s = SysInfoFromFactory()
+        self.assertEqual('1:10', s.get_uptime_desc())
+
     def test_sysinfo_osx(self):
         """Tests the OS X implementation of SysInfo. Note that this
         tests deep into the implementation, and not just the



More information about the bind10-changes mailing list