# Path: reflectrpc/testing.py
# class ServerRunner(object):
#     """
#     Runs a server program in a subprocess and allows to stop it again
#     """
#     def __init__(self, path, port):
#         self.directory = os.path.dirname(path)
#         self.server_program = os.path.basename(path)
#         self.host = 'localhost'
#         self.port = port
#         self.pid = None
#         self.timeout = 5
# 
#     def run(self):
#         # we don't fork before we know that the TCP port/UNIX socket is free
#         if isinstance(self.port, int):
#             wait_for_free_port(self.host, self.port, self.timeout)
#         else:
#             wait_for_unix_socket_gone(self.port, self.timeout)
# 
#         pid = os.fork()
# 
#         if not pid:
#             # child
#             os.chdir(self.directory)
# 
#             if self.server_program.endswith('.py'):
#                 python = sys.executable
#                 os.execl(python, python, self.server_program)
#             else:
#                 os.execl(self.server_program, self.server_program)
#         else:
#             # parent
#             self.pid = pid
# 
#             if isinstance(self.port, int):
#                 wait_for_tcp_port_in_use(self.host, self.port, self.timeout)
#             else:
#                 wait_for_unix_socket_in_use(self.port, self.timeout)
# 
#     def stop(self):
#         os.kill(self.pid, signal.SIGINT)
#         os.waitpid(self.pid, 0)
# 
#         if isinstance(self.port, int):
#             wait_for_free_port(self.host, self.port, self.timeout)
#         else:
#             wait_for_unix_socket_gone(self.port, self.timeout)


from builtins import bytes, dict, list, int, float, str
from reflectrpc.testing import ServerRunner
import errno
import sys
import json
import os
import os.path
import pexpect
import shutil
import subprocess
import tempfile
import unittest
#!/usr/bin/env python3

from __future__ import unicode_literals


sys.path.append('..')


class RpcDocTests(unittest.TestCase):
    def test_rpcdoc_basic_operation(self):
        try:

# Path: reflectrpc/testing.py
# class ServerRunner(object):
#     """
#     Runs a server program in a subprocess and allows to stop it again
#     """
#     def __init__(self, path, port):
#         self.directory = os.path.dirname(path)
#         self.server_program = os.path.basename(path)
#         self.host = 'localhost'
#         self.port = port
#         self.pid = None
#         self.timeout = 5
# 
#     def run(self):
#         # we don't fork before we know that the TCP port/UNIX socket is free
#         if isinstance(self.port, int):
#             wait_for_free_port(self.host, self.port, self.timeout)
#         else:
#             wait_for_unix_socket_gone(self.port, self.timeout)
# 
#         pid = os.fork()
# 
#         if not pid:
#             # child
#             os.chdir(self.directory)
# 
#             if self.server_program.endswith('.py'):
#                 python = sys.executable
#                 os.execl(python, python, self.server_program)
#             else:
#                 os.execl(self.server_program, self.server_program)
#         else:
#             # parent
#             self.pid = pid
# 
#             if isinstance(self.port, int):
#                 wait_for_tcp_port_in_use(self.host, self.port, self.timeout)
#             else:
#                 wait_for_unix_socket_in_use(self.port, self.timeout)
# 
#     def stop(self):
#         os.kill(self.pid, signal.SIGINT)
#         os.waitpid(self.pid, 0)
# 
#         if isinstance(self.port, int):
#             wait_for_free_port(self.host, self.port, self.timeout)
#         else:
#             wait_for_unix_socket_gone(self.port, self.timeout)


# Path: tests/rpcdoc-tests.py
from builtins import bytes, dict, list, int, float, str
from reflectrpc.testing import ServerRunner
import errno
import sys
import json
import os
import os.path
import pexpect
import shutil
import subprocess
import tempfile
import unittest

#!/usr/bin/env python3

from __future__ import unicode_literals


sys.path.append('..')


class RpcDocTests(unittest.TestCase):
    def test_rpcdoc_basic_operation(self):
        try:

            server = ServerRunner('../examples/server.py', 5500)