@@ -375,6 +375,13 @@ def shared_task_manager():
375375 return TaskManager ()
376376
377377
378+ @pytest .fixture (scope = "module" )
379+ def test_configs_task_manager ():
380+ """TaskManager with only test_configs tasks (fast - no default task scanning)"""
381+ test_configs_path = Path (__file__ ).parent / "test_configs"
382+ return TaskManager (include_path = str (test_configs_path ), include_defaults = False )
383+
384+
378385class TestTaskManagerIntegration :
379386 def test_initialization (self , shared_task_manager ):
380387 """TaskManager initializes with default tasks"""
@@ -407,16 +414,20 @@ def test_all_tags_property(self, shared_task_manager):
407414 for t in tags [:5 ]: # Check first 5
408415 assert shared_task_manager ._name_is_tag (t )
409416
410- def test_load_task_by_name (self , shared_task_manager ):
417+ def test_load_task_by_name (self , test_configs_task_manager ):
411418 """Load a single task by name"""
412- result = shared_task_manager .load_task_or_group (["arc_easy" ])
413- assert "arc_easy" in result
414-
415- def test_load_group_by_name (self , shared_task_manager ):
416- """Load a group and get nested structure"""
417- result = shared_task_manager .load_task_or_group (["ai2_arc" ])
418- # ai2_arc is a tag that contains arc_easy and arc_challenge
419- assert "arc_easy" in result or "arc_challenge" in result
419+ result = test_configs_task_manager .load_task_or_group (["simple_task" ])
420+ assert "simple_task" in result
421+
422+ def test_load_group_by_name (self , test_configs_task_manager ):
423+ """Load a group and get nested structure with namespaced task names"""
424+ result = test_configs_task_manager .load_task_or_group (["test_group" ])
425+ # Result is {ConfigurableGroup: {task_name: task_obj}}
426+ # Get the children dict from the group
427+ children = list (result .values ())[0 ]
428+ # test_group contains inline tasks, namespaced as group_name::task_name
429+ assert "test_group::group_task_fs0" in children
430+ assert "test_group::group_task_fs2" in children
420431
421432 def test_load_tag_by_name (self , shared_task_manager ):
422433 """Load all tasks in a tag"""
@@ -522,6 +533,33 @@ def test_task_list_overrides(self):
522533 assert "acc" in metric_names
523534 assert "acc_norm" in metric_names
524535
536+ def test_task_list_base_field_inheritance (self ):
537+ """Test that task_list tasks inherit base fields from the shared config"""
538+ test_configs_path = Path (__file__ ).parent / "test_configs"
539+ tm = TaskManager (include_path = str (test_configs_path ), include_defaults = False )
540+
541+ result = tm .load_task_or_group (["task_list_fs0" ])
542+ task = result ["task_list_fs0" ]
543+
544+ # Base fields should be inherited from the shared config
545+ assert task .config .dataset_path == "json" , (
546+ "Should inherit dataset_path from base"
547+ )
548+ assert task .config .output_type == "multiple_choice" , (
549+ "Should inherit output_type from base"
550+ )
551+ assert task .config .doc_to_text == "{{question}}" , (
552+ "Should inherit doc_to_text from base"
553+ )
554+ assert task .config .test_split == "test" , "Should inherit test_split from base"
555+
556+ # Default metric_list should be inherited (task_list_fs0 doesn't override it)
557+ metric_names = [m ["metric" ] for m in task .config .metric_list ]
558+ assert "acc" in metric_names , "Should inherit metric_list from base"
559+
560+ # Per-task override should still be applied
561+ assert task .config .num_fewshot == 0 , "Should have per-task num_fewshot override"
562+
525563 def test_match_tasks_glob (self , shared_task_manager ):
526564 """match_tasks handles glob patterns"""
527565 matches = shared_task_manager .match_tasks (["arc_*" ])
@@ -543,7 +581,7 @@ def test_name_is_tag(self, shared_task_manager):
543581 assert shared_task_manager ._name_is_tag ("ai2_arc" )
544582 assert not shared_task_manager ._name_is_tag ("arc_easy" ) # This is a task
545583
546- def test_include_path_precedence (self ):
584+ def test_include_path_precedence (self , shared_task_manager ):
547585 """Test that user-specified include paths take precedence over default paths when tasks have the same name."""
548586 with tempfile .TemporaryDirectory () as custom_dir :
549587 # Create a custom arc_easy.yaml that has a different metric
@@ -589,8 +627,8 @@ def test_include_path_precedence(self):
589627 )
590628
591629 # Test 2: Verify default is used when no custom path is provided
592- default_task_manager = TaskManager ( include_defaults = True )
593- default_task_dict = default_task_manager .load_task_or_group (["arc_easy" ])
630+ # Use shared_task_manager instead of creating a new one (saves ~9s )
631+ default_task_dict = shared_task_manager .load_task_or_group (["arc_easy" ])
594632 default_arc_easy = default_task_dict ["arc_easy" ]
595633
596634 # Default should not have f1 metric or custom text
0 commit comments