@@ -224,6 +224,44 @@ def test_phase_switching_preserves_existing_data():
224224 assert exec_values == [100 , 200 , 300 ]
225225
226226
227+ def test_multiple_managers_phase_isolation ():
228+ """Test that phase dependence for managers is isolated."""
229+ manager1 = TestPhaseManager ()
230+ manager2 = TestPhaseManager ()
231+
232+ # Both managers should start in execution phase
233+ assert manager1 .get_current_phase () == TestPhase .EXECUTION
234+ assert manager2 .get_current_phase () == TestPhase .EXECUTION
235+
236+ # Change phase of manager1 to setup
237+ with manager1 .setup ():
238+ # manager1 should be in setup phase
239+ assert manager1 .get_current_phase () == TestPhase .SETUP
240+ # manager2 should still be in execution phase
241+ assert manager2 .get_current_phase () == TestPhase .EXECUTION
242+
243+ # Add transactions to verify phase isolation
244+ tx1 = Transaction (to = Address (0x100 ), value = 100 , gas_limit = 21000 )
245+ tx2 = Transaction (to = Address (0x200 ), value = 200 , gas_limit = 21000 )
246+
247+ manager1 .add_transaction (tx1 )
248+ manager2 .add_transaction (tx2 )
249+
250+ # Verify transactions are in correct phases
251+ assert tx1 .test_phase == TestPhase .SETUP .value
252+ assert tx2 .test_phase == TestPhase .EXECUTION .value
253+
254+ # After exiting setup context, manager1 should return to execution phase
255+ assert manager1 .get_current_phase () == TestPhase .EXECUTION
256+ assert manager2 .get_current_phase () == TestPhase .EXECUTION
257+
258+ # Verify final state
259+ assert len (manager1 .setup_transactions ) == 1
260+ assert len (manager1 .execution_transactions ) == 0
261+ assert len (manager2 .setup_transactions ) == 0
262+ assert len (manager2 .execution_transactions ) == 1
263+
264+
227265@pytest .mark .parametrize (
228266 ["manager_instance" , "expected_phase" ],
229267 [
0 commit comments