@@ -222,3 +222,36 @@ def _fake_run_docker(root: str, image_tag: str, pytest_target: str, run_extras=N
222222 "--cpus=2" ,
223223 "--add-host=host.docker.internal:host-gateway" ,
224224 ]
225+
226+
227+ def test_local_test_normalizes_entry_with_selector (tmp_path , monkeypatch ):
228+ project = tmp_path / "proj"
229+ project .mkdir ()
230+ monkeypatch .chdir (project )
231+
232+ # Create a dummy test file
233+ test_file = project / "metric" / "test_sel_abs.py"
234+ test_file .parent .mkdir (parents = True , exist_ok = True )
235+ test_file .write_text ("def test_dummy():\n assert True\n " , encoding = "utf-8" )
236+
237+ abs_entry = f"{ str (test_file )} ::test_dummy"
238+
239+ from eval_protocol .cli_commands import local_test as lt
240+
241+ # Avoid Docker path
242+ monkeypatch .setattr (lt , "_find_dockerfiles" , lambda root : [])
243+
244+ captured = {"target" : "" }
245+
246+ def _fake_host (target : str ) -> int :
247+ captured ["target" ] = target
248+ return 0
249+
250+ monkeypatch .setattr (lt , "_run_pytest_host" , _fake_host )
251+
252+ args = SimpleNamespace (entry = abs_entry , ignore_docker = False , yes = True )
253+ rc = lt .local_test_command (args ) # pyright: ignore[reportArgumentType]
254+ assert rc == 0
255+ # Expect project-relative path plus selector
256+ rel = os .path .relpath (str (test_file ), str (project ))
257+ assert captured ["target" ] == f"{ rel } ::test_dummy"
0 commit comments