()
| 198 | |
| 199 | |
| 200 | def find_free_port(): |
| 201 | import socket |
| 202 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 203 | # Binding to port 0 will cause the OS to find an available port for us |
| 204 | sock.bind(("", 0)) |
| 205 | port = sock.getsockname()[1] |
| 206 | sock.close() |
| 207 | # NOTE: there is still a chance the port could be taken by other processes. |
| 208 | return port |
| 209 | |
| 210 | |
| 211 | def get_caller_name(depth=0): |
nothing calls this directly
no outgoing calls
no test coverage detected