(self)
| 95 | class TestServer: |
| 96 | |
| 97 | def __init__(self): |
| 98 | |
| 99 | self.may_serve = False |
| 100 | |
| 101 | pid = os.getpid() |
| 102 | logging.info(f"Init server. Pid: {pid}") |
| 103 | |
| 104 | self.server = None |
| 105 | |
| 106 | killer = SiblingKiller(PORT, PING_TIMEOUT) |
| 107 | killer.kill_siblings() |
| 108 | if killer.allow_serving(): |
| 109 | try: |
| 110 | self.init_server() |
| 111 | logging.info(f"Started server with pid: {pid}") |
| 112 | self.may_serve = True |
| 113 | |
| 114 | except socket.error: |
| 115 | logging.info("Failed to start the server: Port is in use") |
| 116 | except Exception as e: |
| 117 | logging.debug(e) |
| 118 | logging.info("Failed to start serving for unknown reason") |
| 119 | traceback.print_exc() |
| 120 | else: |
| 121 | logging.info(f"Not allowed to start serving for process: {pid}") |
| 122 | |
| 123 | def init_server(self): |
| 124 |
no test coverage detected