MCPcopy
hub / github.com/psycopg/psycopg / start

Method start

tests/fix_proxy.py:73–93  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

71 self.proc = None
72
73 def start(self):
74 if self.proc:
75 logging.info("proxy already started")
76 return
77
78 logging.info("starting proxy")
79 pproxy_fix = str(Path(__file__).parent.parent / "tools/pproxy_fix.py")
80 cmdline = [sys.executable, pproxy_fix, "--reuse"]
81 cmdline += ["-l", f"tunnel://:{self.client_port}"]
82 cmdline += ["-r", f"tunnel://{self.server_host}:{self.server_port}"]
83
84 self.proc = sp.Popen(cmdline, stdout=sp.DEVNULL)
85 logging.info("proxy started")
86 self._wait_listen()
87
88 # verify that the proxy works
89 try:
90 with psycopg.connect(self.client_dsn):
91 pass
92 except Exception as e:
93 pytest.fail(f"failed to create a working proxy: {e}")
94
95 def stop(self):
96 if not self.proc:

Callers 15

test_cancel_safe_errorFunction · 0.45
test_cancel_safe_timeoutFunction · 0.45
test_cancel_safe_errorFunction · 0.45
test_cancel_safe_timeoutFunction · 0.45
test_wait_remote_closedFunction · 0.45
test_remote_closedFunction · 0.45
test_cancelFunction · 0.45
test_commit_concurrencyFunction · 0.45
test_notifiesFunction · 0.45
test_cancelFunction · 0.45
test_cancel_streamFunction · 0.45

Calls 4

_wait_listenMethod · 0.95
infoMethod · 0.45
connectMethod · 0.45
failMethod · 0.45

Tested by 15

test_cancel_safe_errorFunction · 0.36
test_cancel_safe_timeoutFunction · 0.36
test_cancel_safe_errorFunction · 0.36
test_cancel_safe_timeoutFunction · 0.36
test_wait_remote_closedFunction · 0.36
test_remote_closedFunction · 0.36
test_cancelFunction · 0.36
test_commit_concurrencyFunction · 0.36
test_notifiesFunction · 0.36
test_cancelFunction · 0.36
test_cancel_streamFunction · 0.36