[Git][NTPsec/ntpsec][master] Fixed test bug on Cent 6 32bit, also SyncPacket formatting typo

Ian Bruene gitlab at mg.gitlab.com
Sun Oct 8 14:02:56 UTC 2017


Ian Bruene pushed to branch master at NTPsec / ntpsec


Commits:
e076c556 by Ian Bruene at 2017-10-08T08:46:33-05:00
Fixed test bug on Cent 6 32bit, also SyncPacket formatting typo

- - - - -


2 changed files:

- pylib/packet.py
- tests/pylib/test_packet.py


Changes:

=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -542,7 +542,7 @@ class SyncPacket(Packet):
 
     def __repr__(self):
         "Represent a posixized sync packet in an eyeball-friendly format."
-        r = "<NTP:%s:%d:%d" % (self.leap(), self.version(), self.mode())
+        r = "<NTP:%s:%d:%d:" % (self.leap(), self.version(), self.mode())
         r += "%f:%f" % (self.root_delay, self.root_dispersion)
         rs = self.refid_as_string()
         if not all(c in string.printable for c in rs):


=====================================
tests/pylib/test_packet.py
=====================================
--- a/tests/pylib/test_packet.py
+++ b/tests/pylib/test_packet.py
@@ -484,10 +484,14 @@ class TestSyncPacket(unittest.TestCase):
 
     def test___repr__(self):
         cls = self.target()
+        cls.reference_timestamp = self.target.posix_to_ntp(0)
+        cls.origin_timestamp = self.target.posix_to_ntp(1)
+        cls.receive_timestamp = self.target.posix_to_ntp(2)
+        cls.transmit_timestamp = self.target.posix_to_ntp(3)
         self.assertEqual(cls.__repr__(),
-                         "<NTP:unsync:4:30.000000:0.000000:0.0.0.0:"
-                         "1900-01-01T00:00:00Z:1900-01-01T00:00:00Z:"
-                         "1900-01-01T00:00:00Z:1900-01-01T00:00:00Z>")
+                         "<NTP:unsync:4:3:0.000000:0.000000:0.0.0.0:"
+                         "1970-01-01T00:00:00Z:1970-01-01T00:00:01Z:"
+                         "1970-01-01T00:00:02Z:1970-01-01T00:00:03Z>")
 
 
 class TestMisc(unittest.TestCase):



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/e076c556e75d660f817e5b337e9114c44a936107

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/e076c556e75d660f817e5b337e9114c44a936107
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20171008/89d94f36/attachment.html>


More information about the vc mailing list