(writer)
| 5182 | |
| 5183 | |
| 5184 | def _attach_to_writer_pid(writer): |
| 5185 | import pydevd |
| 5186 | import threading |
| 5187 | import subprocess |
| 5188 | |
| 5189 | assert writer.process is not None |
| 5190 | |
| 5191 | def attach(): |
| 5192 | attach_pydevd_file = os.path.join(os.path.dirname(pydevd.__file__), "pydevd_attach_to_process", "attach_pydevd.py") |
| 5193 | subprocess.call( |
| 5194 | [ |
| 5195 | sys.executable, |
| 5196 | attach_pydevd_file, |
| 5197 | "--pid", |
| 5198 | str(writer.process.pid), |
| 5199 | "--port", |
| 5200 | str(writer.port), |
| 5201 | "--protocol", |
| 5202 | "http_json", |
| 5203 | "--debug-mode", |
| 5204 | "debugpy-dap", |
| 5205 | ] |
| 5206 | ) |
| 5207 | |
| 5208 | threading.Thread(target=attach).start() |
| 5209 | |
| 5210 | wait_for_condition(lambda: writer.finished_initialization) |
| 5211 | |
| 5212 | |
| 5213 | @pytest.mark.parametrize("reattach", [True, False]) |
no test coverage detected