client.send(query.to_wire())
        answer, _ = recvfrom_message(client)
        if answer is None:
            raise Exception("no answer received")
        if not query.is_response(answer):
            raise Exception("not a mirror response")
    finally:
        server.stop()
        client.close()


if __name__ == "__main__":

    # Self-test code
    test = test.Test()
    test.add("testserver/sendrecv", test_sendrecv)
    if test.run() != 0:
        sys.exit(1)

    # Mirror server
    server = TestServer(None)
    server.start()
    server.get_server_socket(None, socket.AF_INET)
    print ("[==========] Mirror server running at", server.address())
    try:
        while True:
            time.sleep(0.5)
    except KeyboardInterrupt:
        print ("[==========] Shutdown.")
        pass
    server.stop()
Example #2
0
import sys

print type(sys.path)

for i in sys.path:
    print i


import test

print test.add
test.add()
Example #3
0
 def test_add(self):
     self.assertTrue(add(-1,5))
Example #4
0
def index():
  x = test.add()
  return x
Example #5
0
import test
print dir(test)
print test.add(2,3)
Example #6
0
def siteprocess(request):
    test.add()
    return HttpResponse("Yaay",status='200')
Example #7
0
#!/usr/bin/env python
# coding=utf-8

import test 


if __name__ == "__main__":

    print test.add(100,100)