diff --git a/src/tests/test_packets.py b/src/tests/test_packets.py index 65ee0d44..3a0c43e9 100644 --- a/src/tests/test_packets.py +++ b/src/tests/test_packets.py @@ -1,14 +1,15 @@ +"""Test packets creation and parsing""" -import unittest from binascii import unhexlify from struct import pack from pybitmessage import addresses, protocol from .samples import magic +from .test_protocol import TestSocketInet -class TestSerialize(unittest.TestCase): +class TestSerialize(TestSocketInet): """Test serializing and deserializing packet data""" def test_varint(self): diff --git a/src/tests/test_protocol.py b/src/tests/test_protocol.py index d285d1df..e3137b25 100644 --- a/src/tests/test_protocol.py +++ b/src/tests/test_protocol.py @@ -9,14 +9,18 @@ from pybitmessage import protocol, state from pybitmessage.helper_startup import fixSocket -class TestProtocol(unittest.TestCase): - """Main protocol test case""" +class TestSocketInet(unittest.TestCase): + """Base class for test cases using protocol.encodeHost()""" @classmethod def setUpClass(cls): """Execute fixSocket() before start. Only for Windows?""" fixSocket() + +class TestProtocol(TestSocketInet): + """Main protocol test case""" + def test_checkIPv4Address(self): """Check the results of protocol.checkIPv4Address()""" token = 'HELLO'