File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,24 @@ def task_write_text(depends_on, produces):
38
38
39
39
40
40
@pytest .mark .end_to_end ()
41
- def test_collect_module_name_ (tmp_path ):
41
+ def test_collect_tasks_from_modules_with_the_same_name (tmp_path ):
42
+ """We need to check that task modules can have the same name. See #373 and #374."""
43
+ tmp_path .joinpath ("a" ).mkdir ()
44
+ tmp_path .joinpath ("b" ).mkdir ()
45
+ tmp_path .joinpath ("a" , "task_module.py" ).write_text ("def task_a(): pass" )
46
+ tmp_path .joinpath ("b" , "task_module.py" ).write_text ("def task_a(): pass" )
47
+ session = main ({"paths" : tmp_path })
48
+ assert len (session .collection_reports ) == 2
49
+ assert all (
50
+ report .outcome == CollectionOutcome .SUCCESS
51
+ for report in session .collection_reports
52
+ )
53
+ assert session .collection_reports [0 ].node .function .__module__ == "a.task_module"
54
+ assert session .collection_reports [1 ].node .function .__module__ == "b.task_module"
55
+
56
+
57
+ @pytest .mark .end_to_end ()
58
+ def test_collect_module_name (tmp_path ):
42
59
"""We need to add a task module to the sys.modules. See #373 and #374."""
43
60
source = """
44
61
# without this import, everything works fine
You can’t perform that action at this time.
0 commit comments