@@ -146,14 +146,15 @@ def test_pdb_pass_empty_path_if_in_session(tmp_path, setup_test_repo):
146146 )
147147 pdb = PDBTool ()
148148 _ = pdb .start_pdb (environment )
149+ wd = environment .working_dir
149150
150151 obs = pdb .use (environment , command = "b test_pass.py:1" ).observation
151- assert obs .startswith ("Pdb command output:\n Breakpoint 1 at test_pass.py:1" )
152+ assert obs .startswith (f "Pdb command output:\n Breakpoint 1 at { wd } / test_pass.py:1" )
152153 obs = pdb .use (environment , command = "c" ).observation
153154 assert "1 B->\t def test_pass():" in obs
154155 # Now try to set a breakpoint without specifying the file, it should pass
155156 obs = pdb .use (environment , command = "b 2" ).observation
156- assert obs .startswith ("Pdb command output:\n Breakpoint 2 at test_pass.py:2" )
157+ assert obs .startswith (f "Pdb command output:\n Breakpoint 2 at { wd } / test_pass.py:2" )
157158
158159
159160def test_pdb_use_default_environment_entrypoint (tmp_path , setup_test_repo ):
@@ -241,7 +242,9 @@ def test_pdb_add_new_breakpoint_relative_path(tmp_path, setup_pdb_repo_env):
241242 breakpoints_state = copy .deepcopy (env .current_breakpoints_state )
242243 wd = env .working_dir
243244 pdb_obs = pdb_tool .use (env , "b file1.py:25" )
244- assert "Pdb command output:\n Breakpoint 5 at file1.py:25" in pdb_obs .observation
245+ assert (
246+ f"Pdb command output:\n Breakpoint 5 at { wd } /file1.py:25" in pdb_obs .observation
247+ )
245248 new_breakpoint = {f"{ wd } /file1.py|||25" : f"b { wd } /file1.py:25" }
246249 expected_state = breakpoints_state | new_breakpoint
247250 assert env .current_breakpoints_state == expected_state
@@ -252,7 +255,9 @@ def test_pdb_add_new_breakpoint_absolute_path(tmp_path, setup_pdb_repo_env):
252255 breakpoints_state = copy .deepcopy (env .current_breakpoints_state )
253256 wd = env .working_dir
254257 pdb_obs = pdb_tool .use (env , f"b { wd } /file1.py:25" )
255- assert "Pdb command output:\n Breakpoint 5 at file1.py:25" in pdb_obs .observation
258+ assert (
259+ f"Pdb command output:\n Breakpoint 5 at { wd } /file1.py:25" in pdb_obs .observation
260+ )
256261 new_breakpoint = {f"{ wd } /file1.py|||25" : f"b { wd } /file1.py:25" }
257262 expected_state = breakpoints_state | new_breakpoint
258263 assert env .current_breakpoints_state == expected_state
@@ -261,8 +266,11 @@ def test_pdb_add_new_breakpoint_absolute_path(tmp_path, setup_pdb_repo_env):
261266def test_pdb_add_existing_breakpoint (tmp_path , setup_pdb_repo_env ):
262267 pdb_tool , env = setup_pdb_repo_env (tmp_path )
263268 breakpoints_state = copy .deepcopy (env .current_breakpoints_state )
264- pdb_obs = pdb_tool .use (env , "b file1.py:10" )
265- assert "Pdb command output:\n Breakpoint 5 at file1.py:10" in pdb_obs .observation
269+ wd = env .working_dir
270+ pdb_obs = pdb_tool .use (env , f"b { wd } /file1.py:10" )
271+ assert (
272+ f"Pdb command output:\n Breakpoint 5 at { wd } /file1.py:10" in pdb_obs .observation
273+ )
266274 assert env .current_breakpoints_state == breakpoints_state
267275
268276
@@ -276,7 +284,7 @@ def test_pdb_clear_specific(tmp_path, setup_pdb_repo_env):
276284 f"{ wd } /file2.py|||15" : f"b { wd } /file2.py:15" ,
277285 }
278286 assert pdb_obs .observation .startswith (
279- "Pdb command output:\n Deleted breakpoint 2 at file1.py:20\n \n Current frame:"
287+ f "Pdb command output:\n Deleted breakpoint 2 at { wd } / file1.py:20\n \n Current frame:"
280288 )
281289 assert env .current_breakpoints_state == expected_state
282290
@@ -287,9 +295,10 @@ def test_pdb_clear_not_found(
287295):
288296 pdb_tool , env = setup_pdb_repo_env (tmp_path )
289297 breakpoints_state = copy .deepcopy (env .current_breakpoints_state )
298+ wd = env .working_dir
290299 pdb_obs = pdb_tool .use (env , "cl file1.py:8" )
291300 assert pdb_obs .observation .startswith (
292- "Pdb command output:\n *** There is no breakpoint at file1.py:8"
301+ f "Pdb command output:\n *** There is no breakpoint at { wd } / file1.py:8"
293302 )
294303 assert env .current_breakpoints_state == breakpoints_state
295304
@@ -568,19 +577,22 @@ def test_use_pdb_syntax_error(tmp_path, setup_pdb_repo_env):
568577
569578def test_set_current_frame_file_sets_file (tmp_path , setup_pdb_repo_env ):
570579 pdb_tool , env = setup_pdb_repo_env (tmp_path )
580+ wd = env .working_dir
571581 # First stop at pytest main file
572582 assert "pytest/__main__.py" in pdb_tool .current_frame_file
573583 # pdb_tool.use calls pdb_tool.set_current_frame_file(env)
574584 obs = pdb_tool .use (env , "b test_fail.py:2" )
575- assert "Pdb command output:\n Breakpoint 5 at test_fail.py:2" in obs .observation
585+ assert (
586+ f"Pdb command output:\n Breakpoint 5 at { wd } /test_fail.py:2" in obs .observation
587+ )
576588 # no `continue` command, so current_frame_file should still be pytest main file
577589 assert "pytest/__main__.py" in pdb_tool .current_frame_file
578590 obs = pdb_tool .use (env , "c" )
579591 # At this point, current_frame_file should be set to the file where the breakpoint was set
580- assert pdb_tool .current_frame_file == f"{ env . working_dir } /test_fail.py"
592+ assert pdb_tool .current_frame_file == f"{ wd } /test_fail.py"
581593 # observation should contain the test file
582- assert f"Current frame:\n { env . working_dir } /test_fail.py" in obs .observation
583- assert "> test_fail.py(2)" in obs .observation
594+ assert f"Current frame:\n { wd } /test_fail.py" in obs .observation
595+ assert f "> { wd } / test_fail.py(2)" in obs .observation
584596
585597
586598def test_set_current_frame_file_sets_and_returns (tmp_path , setup_pdb_repo_env ):
@@ -600,6 +612,7 @@ def fake_interact_with_pdb(command, timeout):
600612def test_use_multiple_commands_only_first_executed (tmp_path , setup_pdb_repo_env ):
601613 pdb_tool , env = setup_pdb_repo_env (tmp_path )
602614 env .current_breakpoints_state = {}
615+ wd = env .working_dir
603616 pdb_tool .restart_pdb (env )
604617 pdb_obs = pdb_tool .use (env , "b" )
605618 obs = clean_up_pytest_path (pdb_obs .observation )
@@ -627,7 +640,7 @@ def test_use_multiple_commands_only_first_executed(tmp_path, setup_pdb_repo_env)
627640 assert pdb_obs .source == "pdb"
628641 assert pdb_obs .observation .startswith (
629642 "Multiple commands are not supported. Only the first command will be executed.\n "
630- "Pdb command output:\n Breakpoint 1 at file1.py:1\n "
643+ f "Pdb command output:\n Breakpoint 1 at { wd } / file1.py:1\n "
631644 "\n "
632645 "Current frame:"
633646 )
@@ -668,7 +681,8 @@ def test_use_starts_pdb_if_not_running(tmp_path, setup_pdb_repo_env):
668681def test_pdb_list_output_indentation (tmp_path , setup_pdb_repo_env ):
669682 """Test PDB list output indentation for line numbers around 100 (3-digit)"""
670683 pdb_tool , env = setup_pdb_repo_env (tmp_path )
671- with (env .working_dir / "large_file.py" ).open ("w" ) as f :
684+ wd = env .working_dir
685+ with (wd / "large_file.py" ).open ("w" ) as f :
672686 f .write ("def dummy_function():\n " )
673687 f .write ("\n " .join (f" 'Line { i + 1 } '" for i in range (1 , 2000 )))
674688 f .write ("\n \n if __name__ == '__main__':\n " )
@@ -677,7 +691,7 @@ def test_pdb_list_output_indentation(tmp_path, setup_pdb_repo_env):
677691 pdb_tool .start_pdb (env )
678692 pdb_obs = pdb_tool .use (env , "b large_file.py:100" )
679693 assert (
680- "Pdb command output:\n Breakpoint 5 at large_file.py:100"
694+ f "Pdb command output:\n Breakpoint 5 at { wd } / large_file.py:100"
681695 ) in pdb_obs .observation
682696 pdb_obs = pdb_tool .use (env , "c" )
683697 expected_output = (
@@ -698,7 +712,8 @@ def test_pdb_list_output_indentation(tmp_path, setup_pdb_repo_env):
698712
699713 pdb_obs = pdb_tool .use (env , "b large_file.py:1000" )
700714 assert (
701- "Pdb command output:\n Breakpoint 6 at large_file.py:1000" in pdb_obs .observation
715+ f"Pdb command output:\n Breakpoint 6 at { wd } /large_file.py:1000"
716+ in pdb_obs .observation
702717 )
703718 pdb_obs = pdb_tool .use (env , "c" )
704719 expected_output = (
@@ -719,7 +734,8 @@ def test_pdb_list_output_indentation(tmp_path, setup_pdb_repo_env):
719734
720735 pdb_obs = pdb_tool .use (env , "b large_file.py:2000" )
721736 assert (
722- "Pdb command output:\n Breakpoint 7 at large_file.py:2000" in pdb_obs .observation
737+ f"Pdb command output:\n Breakpoint 7 at { wd } /large_file.py:2000"
738+ in pdb_obs .observation
723739 )
724740 pdb_obs = pdb_tool .use (env , "c" )
725741 expected_output = (
0 commit comments