@@ -102,15 +102,13 @@ def __init__(
102102 module : cst .Module ,
103103 test : GeneratedTests ,
104104 tests_root : Path ,
105- rel_tests_root : Path ,
106105 original_runtimes : dict [InvocationId , list [int ]],
107106 optimized_runtimes : dict [InvocationId , list [int ]],
108107 ) -> None :
109108 super ().__init__ ()
110109 self .test = test
111110 self .context_stack : list [str ] = []
112111 self .tests_root = tests_root
113- self .rel_tests_root = rel_tests_root
114112 self .module = module
115113 self .cfo_locs : list [int ] = []
116114 self .cfo_idx_loc_to_look_at : int = - 1
@@ -163,8 +161,8 @@ def leave_SimpleStatementLine(
163161 )
164162 rel_path = (
165163 Path (invocation_id .test_module_path .replace ("." , os .sep ))
166- .with_suffix (".py" )
167- .relative_to (self .rel_tests_root )
164+ .with_suffix (".py" ). resolve ()
165+ .relative_to (self .tests_root )
168166 )
169167 if (
170168 qualified_name == "." .join (self .context_stack )
@@ -186,8 +184,8 @@ def leave_SimpleStatementLine(
186184 )
187185 rel_path = (
188186 Path (invocation_id .test_module_path .replace ("." , os .sep ))
189- .with_suffix (".py" )
190- .relative_to (self .rel_tests_root )
187+ .with_suffix (".py" ). resolve ()
188+ .relative_to (self .tests_root )
191189 )
192190 if (
193191 qualified_name == "." .join (self .context_stack )
@@ -241,7 +239,6 @@ def add_runtime_comments_to_generated_tests(
241239 """Add runtime performance comments to function calls in generated tests."""
242240 tests_root = test_cfg .tests_root
243241 module_root = test_cfg .project_root_path
244- rel_tests_root = tests_root .relative_to (module_root )
245242
246243 # Process each generated test
247244 modified_tests = []
@@ -250,9 +247,9 @@ def add_runtime_comments_to_generated_tests(
250247 # Parse the test source code
251248 tree = cst .parse_module (test .generated_original_test_source )
252249 # Transform the tree to add runtime comments
253- # qualified_name: str, module: cst.Module, test: GeneratedTests, tests_root: Path, rel_tests_root: Path
250+ # qualified_name: str, module: cst.Module, test: GeneratedTests, tests_root: Path
254251 transformer = RuntimeCommentTransformer (
255- qualified_name , tree , test , tests_root , rel_tests_root , original_runtimes , optimized_runtimes
252+ qualified_name , tree , test , tests_root , original_runtimes , optimized_runtimes
256253 )
257254 modified_tree = tree .visit (transformer )
258255
0 commit comments