Skip to content

Commit d55c15e

Browse files
committed
debugging
1 parent 184e8e3 commit d55c15e

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

Lib/test/libregrtest/worker.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,16 @@ def main() -> NoReturn:
122122
tmp_dir = get_temp_dir()
123123
work_dir = get_work_dir(tmp_dir, worker=True)
124124

125-
with exit_timeout():
126-
with os_helper.temp_cwd(work_dir, quiet=True):
127-
worker_process(worker_json)
125+
try:
126+
with exit_timeout():
127+
with os_helper.temp_cwd(work_dir, quiet=True):
128+
worker_process(worker_json)
129+
except PermissionError:
130+
import pathlib
131+
location = pathlib.Path(work_dir)
132+
files = list(location.glob("*/*"))
133+
print(files, file=sys.__stderr__)
134+
raise
128135

129136

130137
if __name__ == "__main__":

Lib/test/support/os_helper.py

+1
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ def temp_cwd(name='tempcwd', quiet=False):
599599
yield cwd_dir
600600

601601

602+
602603
def create_empty_file(filename):
603604
"""Create an empty file. If the file already exists, truncate it."""
604605
fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC)

Lib/test/test_external_inspection.py

+30-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ def foo():
7878
response = client_socket.recv(1024)
7979
self.assertEqual(response, b"ready")
8080
stack_trace = get_stack_trace(p.pid)
81+
import pathlib
82+
location = pathlib.Path(os.getcwd())
83+
files = list(location.glob("*/*"))
84+
print(files, file=sys.__stderr__)
85+
8186
except PermissionError:
8287
self.skipTest("Insufficient permissions to read the stack trace")
8388
finally:
@@ -164,6 +169,11 @@ def new_eager_loop():
164169
response = client_socket.recv(1024)
165170
self.assertEqual(response, b"ready")
166171
stack_trace = get_async_stack_trace(p.pid)
172+
import pathlib
173+
location = pathlib.Path(os.getcwd())
174+
files = list(location.glob("*/*"))
175+
print(files, file=sys.__stderr__)
176+
167177
except PermissionError:
168178
self.skipTest(
169179
"Insufficient permissions to read the stack trace")
@@ -236,6 +246,12 @@ async def main():
236246
response = client_socket.recv(1024)
237247
self.assertEqual(response, b"ready")
238248
stack_trace = get_async_stack_trace(p.pid)
249+
import pathlib
250+
location = pathlib.Path(os.getcwd())
251+
files = list(location.glob("*/*"))
252+
print(files, file=sys.__stderr__)
253+
254+
239255
except PermissionError:
240256
self.skipTest("Insufficient permissions to read the stack trace")
241257
finally:
@@ -301,6 +317,11 @@ async def main():
301317
response = client_socket.recv(1024)
302318
self.assertEqual(response, b"ready")
303319
stack_trace = get_async_stack_trace(p.pid)
320+
321+
import pathlib
322+
location = pathlib.Path(os.getcwd())
323+
files = list(location.glob("*/*"))
324+
print(files, file=sys.__stderr__)
304325
except PermissionError:
305326
self.skipTest(
306327
"Insufficient permissions to read the stack trace")
@@ -370,6 +391,11 @@ async def main():
370391
response = client_socket.recv(1024)
371392
self.assertEqual(response, b"ready")
372393
stack_trace = get_async_stack_trace(p.pid)
394+
395+
import pathlib
396+
location = pathlib.Path(os.getcwd())
397+
files = list(location.glob("*/*"))
398+
print(files, file=sys.__stderr__)
373399
except PermissionError:
374400
self.skipTest(
375401
"Insufficient permissions to read the stack trace")
@@ -512,6 +538,10 @@ async def main():
512538
# for some reason)
513539
if sys.platform != "win32":
514540
self.assertEqual([[['echo_client_spam'], 'echo client spam', [[['main'], 'Task-1', []]]]], entries[-1][1])
541+
import pathlib
542+
location = pathlib.Path(os.getcwd())
543+
files = list(location.glob("*/*"))
544+
print(files, file=sys.__stderr__)
515545
except PermissionError:
516546
self.skipTest(
517547
"Insufficient permissions to read the stack trace")
@@ -528,6 +558,5 @@ async def main():
528558
def test_self_trace(self):
529559
stack_trace = get_stack_trace(os.getpid())
530560
self.assertEqual(stack_trace[0], "test_self_trace")
531-
532561
if __name__ == "__main__":
533562
unittest.main()

0 commit comments

Comments
 (0)