Python3 test failures

$ python3 -m unittest discover -s build/main/tests/pylib
EEFFFEEEEEEEEEEEEFEEEEEEEEFEE.FFE.FF.............................................................................................................
======================================================================
ERROR: test_AddAgentCapsPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1354, in test_AddAgentCapsPDU
    pkt_str = pkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 594, in encode
    contextP, payload = encode_context(self.bigEndian, self.context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 1001, in encode_context
    payload = encode_octetstr(bigEndian, context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 751, in encode_octetstr
    data = header + octets + pad
TypeError: can't concat str to bytes

======================================================================
ERROR: test_AgentXPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 97, in test_AgentXPDU
    self.assertEqual(repr(test),
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 81, in __repr__
    keys.sort()  # they will always be in the same order: testable
AttributeError: 'dict_keys' object has no attribute 'sort'

======================================================================
ERROR: test_GetBulkPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 674, in test_GetBulkPDU
    pkt_str = pkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 353, in encode
    contextP, payload = encode_context(self.bigEndian, self.context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 1001, in encode_context
    payload = encode_octetstr(bigEndian, context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 751, in encode_octetstr
    data = header + octets + pad
TypeError: can't concat str to bytes

======================================================================
ERROR: test_GetNextPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 574, in test_GetNextPDU
    nullPkt_str = nullPkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 307, in encode
    return header + payload
TypeError: can't concat str to bytes

======================================================================
ERROR: test_GetPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 472, in test_GetPDU
    nullPkt_str = nullPkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 302, in encode
    self.oidranges, self._nullTerm)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 865, in encode_searchrange_list
    encoded = "".join(encoded)
TypeError: sequence item 0: expected str instance, bytes found

======================================================================
ERROR: test_IndexAllocPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1145, in test_IndexAllocPDU
    pkt_str = pkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 547, in encode
    contextP, payload = encode_context(self.bigEndian, self.context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 1001, in encode_context
    payload = encode_octetstr(bigEndian, context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 751, in encode_octetstr
    data = header + octets + pad
TypeError: can't concat str to bytes

======================================================================
ERROR: test_IndexDeallocPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1255, in test_IndexDeallocPDU
    pkt_str = pkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 547, in encode
    contextP, payload = encode_context(self.bigEndian, self.context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 1001, in encode_context
    payload = encode_octetstr(bigEndian, context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 751, in encode_octetstr
    data = header + octets + pad
TypeError: can't concat str to bytes

======================================================================
ERROR: test_NotifyPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1040, in test_NotifyPDU
    pkt_str = pkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 504, in encode
    contextP, payload = encode_context(self.bigEndian, self.context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 1001, in encode_context
    payload = encode_octetstr(bigEndian, context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 751, in encode_octetstr
    data = header + octets + pad
TypeError: can't concat str to bytes

======================================================================
ERROR: test_OpenPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 133, in test_OpenPDU
    nullPkt_str = nullPkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 143, in encode
    payload += encode_octetstr(self.bigEndian, self.description)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 751, in encode_octetstr
    data = header + octets + pad
TypeError: can't concat str to bytes

======================================================================
ERROR: test_PingPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 980, in test_PingPDU
    pkt_str = pkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 472, in encode
    contextP, payload = encode_context(self.bigEndian, self.context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 1001, in encode_context
    payload = encode_octetstr(bigEndian, context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 751, in encode_octetstr
    data = header + octets + pad
TypeError: can't concat str to bytes

======================================================================
ERROR: test_RMAgentCapsPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1418, in test_RMAgentCapsPDU
    pkt_str = pkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 628, in encode
    contextP, payload = encode_context(self.bigEndian, self.context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 1001, in encode_context
    payload = encode_octetstr(bigEndian, context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 751, in encode_octetstr
    data = header + octets + pad
TypeError: can't concat str to bytes

======================================================================
ERROR: test_RegisterPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 260, in test_RegisterPDU
    basicPkt_str = basicPkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 241, in encode
    self.priority, self.rangeSubid)
TypeError: must be str, not bytes

======================================================================
ERROR: test_ResponsePDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1489, in test_ResponsePDU
    pkt_str = pkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 679, in encode
    payload += encode_varbindlist(self.bigEndian, self.varbinds)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 935, in encode_varbindlist
    payload += encode_varbind(bigEndian, *varbind)
TypeError: must be str, not bytes

======================================================================
ERROR: test_TestSetPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 768, in test_TestSetPDU
    pkt_str = pkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 388, in encode
    contextP, payload = encode_context(self.bigEndian, self.context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 1001, in encode_context
    payload = encode_octetstr(bigEndian, context)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 751, in encode_octetstr
    data = header + octets + pad
TypeError: can't concat str to bytes

======================================================================
ERROR: test_UnregisterPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 369, in test_UnregisterPDU
    basicPkt_str = basicPkt.encode()
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 244, in encode
    self.priority, self.rangeSubid)
TypeError: must be str, not bytes

======================================================================
ERROR: test_compareOID (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 2436, in test_compareOID
    self.assertEqual(f((1, 2, 3, 4), (1, 2, 3, 5)), -1)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 912, in compareOID
    c = cmp(x[i], y[i])
NameError: name 'cmp' is not defined

======================================================================
ERROR: test_decode_packet (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 2179, in test_decode_packet
    self.assertEqual(f("\x01\x01\x10\x00"
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 1019, in decode_packet
    header = decode_pduheader(header)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 977, in decode_pduheader
    version, pduType, flags = struct.unpack(">BBBx", lineone)
TypeError: a bytes-like object is required, not 'str'

======================================================================
ERROR: test_decode_pduheader (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 2111, in test_decode_pduheader
    self.assertEqual(f("\x01\x01\x10\x00"
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 977, in decode_pduheader
    version, pduType, flags = struct.unpack(">BBBx", lineone)
TypeError: a bytes-like object is required, not 'str'

======================================================================
ERROR: test_decode_searchrange_list (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1836, in test_decode_searchrange_list
    standardFlags),
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 872, in decode_searchrange_list
    oids, data = decode_searchrange(data, header)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 853, in decode_searchrange
    startOID, data = decode_oid(data, header)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 723, in decode_oid
    n_subid, prefix, include = struct.unpack("BBBx", header)
TypeError: a bytes-like object is required, not 'str'

======================================================================
ERROR: test_decode_searchrange_list_nullterm (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1860, in test_decode_searchrange_list_nullterm
    "\x00\x00\x00\x00" + extraData, standardFlags),
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 880, in decode_searchrange_list_nullterm
    one, data = decode_oid(data, header)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 723, in decode_oid
    n_subid, prefix, include = struct.unpack("BBBx", header)
TypeError: a bytes-like object is required, not 'str'

======================================================================
ERROR: test_decode_varbind (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1977, in test_decode_varbind
    standardFlags),
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 790, in decode_varbind
    valType = struct.unpack(endianToken + "Hxx", bindheader)[0]
TypeError: a bytes-like object is required, not 'str'

======================================================================
ERROR: test_encode_octetstr (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1883, in test_encode_octetstr
    self.assertEqual(enc(True, ()), "\x00\x00\x00\x00")
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 755, in encode_octetstr
    data = header + data + pad
TypeError: can't concat str to bytes

======================================================================
ERROR: test_encode_searchrange_list (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1805, in test_encode_searchrange_list
    ((2, 3), (3, 4), False))),
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 865, in encode_searchrange_list
    encoded = "".join(encoded)
TypeError: sequence item 0: expected str instance, bytes found

======================================================================
ERROR: test_encode_varbind (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1913, in test_encode_varbind
    self.assertEqual(enc(True, a.NULL, (1, 2, 3)),
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 782, in encode_varbind
    data = header + name + handlers[0](bigEndian, *payload)
TypeError: can't concat str to bytes

======================================================================
ERROR: test_ipaddr (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1619, in test_ipaddr
    self.assertEqual(enc(True, (1, 2, 3, 4)),
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 837, in encode_ipaddr
    return encode_octetstr(bigEndian, octets)
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/ntp/agentx.py", line 755, in encode_octetstr
    data = header + data + pad
TypeError: can't concat str to bytes

======================================================================
FAIL: test_CleanupSetPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 939, in test_CleanupSetPDU
    "\x01\x0B\x10\x00"
AssertionError: b'\x01\x0b\x10\x00\x00\x00\x00\x01\x00\x0[37 chars]\x00' != '\x01\x0b\x10\x00\x00\x00\x00\x01\x00\x00[36 chars]\x00'

======================================================================
FAIL: test_ClosePDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 194, in test_ClosePDU
    "\x01\x02\x10\x00"
AssertionError: b'\x01\x02\x10\x00\x00\x00\x00\x01\x00\x0[53 chars]\x00' != '\x01\x02\x10\x00\x00\x00\x00\x01\x00\x00[52 chars]\x00'

======================================================================
FAIL: test_CommitSetPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 857, in test_CommitSetPDU
    "\x01\x09\x10\x00"
AssertionError: b'\x01\t\x10\x00\x00\x00\x00\x01\x00\x00\[35 chars]\x00' != '\x01\t\x10\x00\x00\x00\x00\x01\x00\x00\x[34 chars]\x00'

======================================================================
FAIL: test_UndoSetPDU (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 898, in test_UndoSetPDU
    "\x01\x0A\x10\x00"
AssertionError: b'\x01\n\x10\x00\x00\x00\x00\x01\x00\x00\[35 chars]\x00' != '\x01\n\x10\x00\x00\x00\x00\x01\x00\x00\x[34 chars]\x00'

======================================================================
FAIL: test_encode_pduheader (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 2095, in test_encode_pduheader
    "\x01\x01\x00\x00"
AssertionError: b'\x01\x01\x00\x00\xef\xbe\xad\xde\xbe\xb[35 chars]\x00' != '\x01\x01\x00\x00ï¾\xadÞ¾ºþÊ\rðÎú\x00\x00\x00\x00'

======================================================================
FAIL: test_integer32 (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1578, in test_integer32
    self.assertEqual(enc(True, 42), "\x00\x00\x00\x2A")
AssertionError: b'\x00\x00\x00*' != '\x00\x00\x00*'

======================================================================
FAIL: test_integer64 (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1602, in test_integer64
    self.assertEqual(enc(True, 42), "\x00\x00\x00\x00\x00\x00\x00\x2A")
AssertionError: b'\x00\x00\x00\x00\x00\x00\x00*' != '\x00\x00\x00\x00\x00\x00\x00*'

======================================================================
FAIL: test_oid (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1645, in test_oid
    self.assertEqual(enc(True, (), False), "\x00\x00\x00\x00")
AssertionError: b'\x00\x00\x00\x00' != '\x00\x00\x00\x00'

======================================================================
FAIL: test_searchrange (test_agentx.TestNtpclientsNtpsnmpd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/selsky/src/gitlab.com/ntpsec/build/main/tests/pylib/test_agentx.py", line 1735, in test_searchrange
    "\x00\x00\x00\x00\x00\x00\x00\x00")
AssertionError: b'\x00\x00\x00\x00\x00\x00\x00\x00' != '\x00\x00\x00\x00\x00\x00\x00\x00'

----------------------------------------------------------------------
Ran 145 tests in 0.042s

FAILED (failures=9, errors=25)

See https://gitlab.com/selsky/ntpsec/-/jobs/34139465 for full logs

cc: @ianbruene