1import sys 2 3import unittest 4import mylib.subpackage.proto.test_pb2 as test_pb2 5import mylib.subpackage.proto.common_pb2 as common_pb2 6 7print(sys.path) 8 9class TestProtoWithPkgPath(unittest.TestCase): 10 11 def test_main(self): 12 x = test_pb2.MyMessage(name="foo", 13 common = common_pb2.MyCommonMessage(common="common")) 14 self.assertEqual(x.name, "foo") 15 self.assertEqual(x.common.common, "common") 16 17if __name__ == '__main__': 18 unittest.main() 19