MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / test_subprocess_quoted_args

Function test_subprocess_quoted_args

tests_python/test_debugger.py:2934–2987  ·  view source on GitHub ↗
(case_setup_multiprocessing, target)

Source from the content-addressed store, hash-verified

2932@pytest.mark.skipif(not IS_CPYTHON, reason="CPython only test.")
2933@pytest.mark.parametrize("target", ["_debugger_case_quoting.py", "_debugger_case_subprocess_zip.py"])
2934def test_subprocess_quoted_args(case_setup_multiprocessing, target):
2935 from tests_python.debugger_unittest import AbstractWriterThread
2936
2937 with case_setup_multiprocessing.test_file(target) as writer:
2938 break_subprocess_line = writer.get_line_index_with_content("break here")
2939
2940 writer.write_add_breakpoint(break_subprocess_line)
2941
2942 server_socket = writer.server_socket
2943
2944 class SecondaryProcessWriterThread(AbstractWriterThread):
2945 TEST_FILE = writer.get_main_filename()
2946 _sequence = -1
2947
2948 class SecondaryProcessThreadCommunication(threading.Thread):
2949 def run(self):
2950 from tests_python.debugger_unittest import ReaderThread
2951 # Note: on linux on Python 2 because on Python 2 CPython subprocess.call will actually
2952 # create a fork first (at which point it'll connect) and then, later on it'll
2953 # call the main (as if it was a clean process as if PyDB wasn't created
2954 # the first time -- the debugger will still work, but it'll do an additional
2955 # connection.
2956
2957 expected_connections = 1
2958
2959 for _ in range(expected_connections):
2960 server_socket.listen(1)
2961 self.server_socket = server_socket
2962 new_sock, addr = server_socket.accept()
2963
2964 reader_thread = ReaderThread(new_sock)
2965 reader_thread.name = " *** Multiprocess Reader Thread"
2966 reader_thread.start()
2967
2968 writer2 = SecondaryProcessWriterThread()
2969
2970 writer2.reader_thread = reader_thread
2971 writer2.sock = new_sock
2972
2973 writer2.write_version()
2974 writer2.write_add_breakpoint(break_subprocess_line)
2975 writer2.write_make_initial_run()
2976 hit = writer2.wait_for_breakpoint_hit()
2977 writer2.write_run_thread(hit.thread_id)
2978
2979 secondary_process_thread_communication = SecondaryProcessThreadCommunication()
2980 secondary_process_thread_communication.start()
2981 writer.write_make_initial_run()
2982
2983 secondary_process_thread_communication.join(10)
2984 if secondary_process_thread_communication.is_alive():
2985 raise AssertionError("The SecondaryProcessThreadCommunication did not finish")
2986
2987 writer.finished_ok = True
2988
2989
2990def _attach_to_writer_pid(writer):

Callers

nothing calls this directly

Calls 8

test_fileMethod · 0.80
write_add_breakpointMethod · 0.80
startMethod · 0.45
joinMethod · 0.45
is_aliveMethod · 0.45

Tested by

no test coverage detected