(
pyfile, tmpdir, run, target, python_key, python, python_args
)
| 252 | @pytest.mark.parametrize("python_key", ["python", "pythonPath"]) |
| 253 | @pytest.mark.flaky(retries=2, delay=1) |
| 254 | def test_custom_python_args( |
| 255 | pyfile, tmpdir, run, target, python_key, python, python_args |
| 256 | ): |
| 257 | @pyfile |
| 258 | def code_to_debug(): |
| 259 | import sys |
| 260 | |
| 261 | import debuggee |
| 262 | from debuggee import backchannel |
| 263 | |
| 264 | debuggee.setup() |
| 265 | backchannel.send([sys.flags.optimize, sys.flags.dont_write_bytecode]) |
| 266 | |
| 267 | custompy = make_custompy(tmpdir) |
| 268 | python = [] if python is None else python.split(",") |
| 269 | python = [(custompy if arg == "custompy" else arg) for arg in python] |
| 270 | python_args = [] if python_args is None else python_args.split(",") |
| 271 | python_cmd = (python if len(python) else [sys.executable]) + python_args |
| 272 | |
| 273 | with debug.Session() as session: |
| 274 | session.config.pop("python", None) |
| 275 | session.config.pop("pythonPath", None) |
| 276 | if len(python): |
| 277 | session.config[python_key] = python[0] if len(python) == 1 else python |
| 278 | if len(python_args): |
| 279 | session.config["pythonArgs"] = python_args |
| 280 | |
| 281 | backchannel = session.open_backchannel() |
| 282 | with run(session, target(code_to_debug)): |
| 283 | pass |
| 284 | |
| 285 | assert backchannel.receive() == ["-O" in python_cmd, "-B" in python_cmd] |
| 286 | |
| 287 | |
| 288 | @pytest.mark.parametrize("run", runners.all) |
nothing calls this directly
no test coverage detected
searching dependent graphs…