@@ -45,6 +45,7 @@ def cli_parser():
4545 "target" ,
4646 "target_kind" ,
4747 "wait_for_client" ,
48+ "parent_session_pid" ,
4849 ]
4950 }
5051
@@ -71,7 +72,7 @@ def parse(args):
7172 log .debug ("Failed to deserialize output: {0}, Output was: {1!r}" , e , output )
7273 raise
7374 except subprocess .CalledProcessError as exc :
74- log .debug ("Process exited with code {0}. Output: {1!r}, Error: {2!r}" ,
75+ log .debug ("Process exited with code {0}. Output: {1!r}, Error: {2!r}" ,
7576 exc .returncode , exc .output , exc .stderr )
7677 raise pickle .loads (exc .output )
7778 except EOFError :
@@ -163,20 +164,20 @@ def test_configure_subProcess_from_environment(cli, value):
163164def test_unsupported_switch (cli ):
164165 with pytest .raises (ValueError ) as ex :
165166 cli (["--listen" , "8888" , "--xyz" , "123" , "spam.py" ])
166-
167+
167168 assert "unrecognized switch --xyz" in str (ex .value )
168169
169170def test_unsupported_switch_from_environment (cli ):
170171 with pytest .raises (ValueError ) as ex :
171172 with mock .patch .dict (os .environ , {"DEBUGPY_EXTRA_ARGV" : "--xyz 123" }):
172173 cli (["--listen" , "8888" , "spam.py" ])
173-
174+
174175 assert "unrecognized switch --xyz" in str (ex .value )
175176
176177def test_unsupported_configure (cli ):
177178 with pytest .raises (ValueError ) as ex :
178179 cli (["--connect" , "127.0.0.1:8888" , "--configure-xyz" , "123" , "spam.py" ])
179-
180+
180181 assert "unknown property 'xyz'" in str (ex .value )
181182
182183def test_unsupported_configure_from_environment (cli ):
@@ -189,26 +190,26 @@ def test_unsupported_configure_from_environment(cli):
189190def test_address_required (cli ):
190191 with pytest .raises (ValueError ) as ex :
191192 cli (["-m" , "spam" ])
192-
193+
193194 assert "either --listen or --connect is required" in str (ex .value )
194195
195196def test_missing_target (cli ):
196197 with pytest .raises (ValueError ) as ex :
197198 cli (["--listen" , "8888" ])
198-
199+
199200 assert "missing target" in str (ex .value )
200201
201202def test_duplicate_switch (cli ):
202203 with pytest .raises (ValueError ) as ex :
203204 cli (["--listen" , "8888" , "--listen" , "9999" , "spam.py" ])
204-
205+
205206 assert "duplicate switch on command line: --listen" in str (ex .value )
206207
207208def test_duplicate_switch_from_environment (cli ):
208209 with pytest .raises (ValueError ) as ex :
209210 with mock .patch .dict (os .environ , {"DEBUGPY_EXTRA_ARGV" : "--listen 8888 --listen 9999" }):
210211 cli (["spam.py" ])
211-
212+
212213 assert "duplicate switch from environment: --listen" in str (ex .value )
213214
214215# Test that switches can be read from the environment
@@ -240,3 +241,10 @@ def test_script_args(cli):
240241
241242 assert argv == ["arg1" , "arg2" ]
242243 assert options ["target" ] == "spam.py"
244+
245+ # Tests that --parent-session-pid fails with --listen
246+ def test_script_parent_pid_with_listen_failure (cli ):
247+ with pytest .raises (ValueError ) as ex :
248+ cli (["--listen" , "8888" , "--parent-session-pid" , "1234" , "spam.py" ])
249+
250+ assert "--parent-session-pid requires --connect" in str (ex .value )
0 commit comments