Esempio n. 1
0
def test_tpayload_pickle():
    ab = thriftpy.load_module("addressbook_thrift")

    person = ab.Person(name="Bob")
    person_2 = pickle.loads(PICKLED_BYTES)

    assert person == person_2
Esempio n. 2
0
def test_load_module():
    ab = thriftpy.load_module("addressbook_thrift")
    assert ab.__name__ == "addressbook_thrift"
    assert sys.modules["addressbook_thrift"] == ab

    # note we can import after load_module
    import addressbook_thrift as ab2
    assert ab2 == ab
Esempio n. 3
0
def _load_service(service_name):
    thrift_module = thriftpy.load_module(
        'walis.thirdparty.thrift.{}_thrift'.format(service_name))

    for key, value in thrift_module.__dict__.items():
        if key.lower().endswith('service'):
            thrift_module.t_service = value

    return thrift_module