@@ -296,9 +296,31 @@ def test_file_tracer_name(self):
296
296
})
297
297
covdata .add_file_tracers ({"p1.foo" : "p1.plugin" , "p2.html" : "p2.plugin" })
298
298
assert covdata .file_tracer ("p1.foo" ) == "p1.plugin"
299
+ assert covdata .file_tracer ("p2.html" ) == "p2.plugin"
299
300
assert covdata .file_tracer ("main.py" ) == ""
300
301
assert covdata .file_tracer ("p3.not_here" ) is None
301
302
303
+ def test_ok_to_repeat_file_tracer (self ):
304
+ covdata = DebugCoverageData ()
305
+ covdata .add_lines ({
306
+ "p1.foo" : dict .fromkeys ([1 , 2 , 3 ]),
307
+ "p2.html" : dict .fromkeys ([10 , 11 , 12 ]),
308
+ })
309
+ covdata .add_file_tracers ({"p1.foo" : "p1.plugin" , "p2.html" : "p2.plugin" })
310
+ covdata .add_file_tracers ({"p1.foo" : "p1.plugin" })
311
+ assert covdata .file_tracer ("p1.foo" ) == "p1.plugin"
312
+
313
+ def test_ok_to_set_empty_file_tracer (self ):
314
+ covdata = DebugCoverageData ()
315
+ covdata .add_lines ({
316
+ "p1.foo" : dict .fromkeys ([1 , 2 , 3 ]),
317
+ "p2.html" : dict .fromkeys ([10 , 11 , 12 ]),
318
+ "main.py" : dict .fromkeys ([20 ]),
319
+ })
320
+ covdata .add_file_tracers ({"p1.foo" : "p1.plugin" , "main.py" : "" })
321
+ assert covdata .file_tracer ("p1.foo" ) == "p1.plugin"
322
+ assert covdata .file_tracer ("main.py" ) == ""
323
+
302
324
def test_cant_file_tracer_unmeasured_files (self ):
303
325
covdata = DebugCoverageData ()
304
326
msg = "Can't add file tracer data for unmeasured file 'p1.foo'"
0 commit comments