@@ -2430,6 +2430,7 @@ mod tests {
24302430
24312431 let error = result. unwrap_err ( ) ;
24322432 pyo3:: Python :: initialize ( ) ;
2433+
24332434 pyo3:: Python :: attach ( |py| {
24342435 assert ! ( error. is_instance_of:: <pyo3:: exceptions:: PyRuntimeError >( py) ) ;
24352436 } ) ;
@@ -2497,6 +2498,7 @@ mod tests {
24972498 let mut actor = create_registered_actor ( clock, cache, trader_id) ;
24982499
24992500 pyo3:: Python :: initialize ( ) ;
2501+
25002502 pyo3:: Python :: attach ( |py| {
25012503 assert ! (
25022504 actor
@@ -2595,6 +2597,7 @@ mod tests {
25952597 msgbus:: subscribe_any ( pattern, handler, None ) ;
25962598
25972599 pyo3:: Python :: initialize ( ) ;
2600+
25982601 Python :: attach ( |py| {
25992602 let val1: Py < PyAny > = 1.0_f64 . into_py_any_unwrap ( py) ;
26002603 let val2: Py < PyAny > = "HIGH" . into_py_any_unwrap ( py) ;
@@ -2644,6 +2647,7 @@ mod tests {
26442647 msgbus:: subscribe_any ( pattern, handler, None ) ;
26452648
26462649 pyo3:: Python :: initialize ( ) ;
2650+
26472651 Python :: attach ( |py| {
26482652 let int_value: Py < PyAny > = 42_i64 . into_py_any_unwrap ( py) ;
26492653 let float_value: Py < PyAny > = 3.5_f64 . into_py_any_unwrap ( py) ;
@@ -2712,6 +2716,7 @@ mod tests {
27122716 * get_message_bus ( ) . borrow_mut ( ) = MessageBus :: default ( ) ;
27132717
27142718 pyo3:: Python :: initialize ( ) ;
2719+
27152720 Python :: attach ( |py| {
27162721 let py_actor = create_tracking_python_actor ( py) . unwrap ( ) ;
27172722
@@ -2745,6 +2750,7 @@ mod tests {
27452750 * get_message_bus ( ) . borrow_mut ( ) = MessageBus :: default ( ) ;
27462751
27472752 pyo3:: Python :: initialize ( ) ;
2753+
27482754 Python :: attach ( |py| {
27492755 let py_actor = create_tracking_python_actor ( py) . unwrap ( ) ;
27502756
@@ -2780,6 +2786,7 @@ mod tests {
27802786 * get_message_bus ( ) . borrow_mut ( ) = MessageBus :: default ( ) ;
27812787
27822788 pyo3:: Python :: initialize ( ) ;
2789+
27832790 Python :: attach ( |py| {
27842791 let py_actor = create_tracking_python_actor ( py) . unwrap ( ) ;
27852792
@@ -2816,6 +2823,7 @@ mod tests {
28162823 * get_message_bus ( ) . borrow_mut ( ) = MessageBus :: default ( ) ;
28172824
28182825 pyo3:: Python :: initialize ( ) ;
2826+
28192827 Python :: attach ( |py| {
28202828 let py_actor = create_tracking_python_actor ( py) . unwrap ( ) ;
28212829
@@ -2853,6 +2861,7 @@ mod tests {
28532861 * get_message_bus ( ) . borrow_mut ( ) = MessageBus :: default ( ) ;
28542862
28552863 pyo3:: Python :: initialize ( ) ;
2864+
28562865 Python :: attach ( |py| {
28572866 let capture_code = c_str ! (
28582867 r#"
@@ -2976,6 +2985,7 @@ class CapturingActor:
29762985 audusd_sim : CurrencyPair ,
29772986 ) {
29782987 pyo3:: Python :: initialize ( ) ;
2988+
29792989 let mut actor = create_registered_actor ( clock, cache, trader_id) ;
29802990
29812991 pyo3:: Python :: attach ( |py| {
@@ -3607,6 +3617,7 @@ class IndicatorEventActor:
36073617 #[ case] method_name : & str ,
36083618 ) {
36093619 pyo3:: Python :: initialize ( ) ;
3620+
36103621 Python :: attach ( |py| {
36113622 assert_python_dispatch ( py, clock, cache, trader_id, method_name, |rust_actor| {
36123623 match method_name {
@@ -3633,6 +3644,7 @@ class IndicatorEventActor:
36333644 #[ case] method_name : & str ,
36343645 ) {
36353646 pyo3:: Python :: initialize ( ) ;
3647+
36363648 Python :: attach ( |py| {
36373649 assert_python_dispatch ( py, clock, cache, trader_id, method_name, |rust_actor| {
36383650 match method_name {
@@ -3662,6 +3674,7 @@ class IndicatorEventActor:
36623674 trader_id : TraderId ,
36633675 ) {
36643676 pyo3:: Python :: initialize ( ) ;
3677+
36653678 Python :: attach ( |py| {
36663679 let py_actor = create_tracking_python_actor ( py) . unwrap ( ) ;
36673680
@@ -3700,6 +3713,7 @@ class IndicatorEventActor:
37003713 bar_type : BarType ,
37013714 ) {
37023715 pyo3:: Python :: initialize ( ) ;
3716+
37033717 Python :: attach ( |py| {
37043718 let mut rust_actor = PyDataActor :: new ( None ) ;
37053719 let indicator = create_tracking_python_indicator ( py) . unwrap ( ) ;
@@ -3750,6 +3764,7 @@ class IndicatorEventActor:
37503764 trader_id : TraderId ,
37513765 ) {
37523766 pyo3:: Python :: initialize ( ) ;
3767+
37533768 Python :: attach ( |py| {
37543769 let events = PyList :: empty ( py) ;
37553770 let py_actor = create_indicator_event_actor ( py, & events) . unwrap ( ) ;
@@ -3815,6 +3830,7 @@ class IndicatorEventActor:
38153830 trader_id : TraderId ,
38163831 ) {
38173832 pyo3:: Python :: initialize ( ) ;
3833+
38183834 Python :: attach ( |py| {
38193835 let events = PyList :: empty ( py) ;
38203836 let py_actor = create_indicator_event_actor ( py, & events) . unwrap ( ) ;
@@ -3844,6 +3860,7 @@ class IndicatorEventActor:
38443860 #[ rstest]
38453861 fn test_registered_indicators_receive_historical_quote_trade_and_bar_batches ( ) {
38463862 pyo3:: Python :: initialize ( ) ;
3863+
38473864 Python :: attach ( |py| {
38483865 let mut rust_actor = PyDataActor :: new ( None ) ;
38493866 let indicator = create_tracking_python_indicator ( py) . unwrap ( ) ;
@@ -3911,6 +3928,7 @@ class IndicatorEventActor:
39113928 #[ rstest]
39123929 fn test_indicators_initialized_requires_all_registered_indicators ( audusd_sim : CurrencyPair ) {
39133930 pyo3:: Python :: initialize ( ) ;
3931+
39143932 Python :: attach ( |py| {
39153933 let mut rust_actor = PyDataActor :: new ( None ) ;
39163934 let first = create_tracking_python_indicator ( py) . unwrap ( ) ;
@@ -3944,6 +3962,7 @@ class IndicatorEventActor:
39443962 trader_id : TraderId ,
39453963 ) {
39463964 pyo3:: Python :: initialize ( ) ;
3965+
39473966 Python :: attach ( |py| {
39483967 let mut rust_actor = PyDataActor :: new ( None ) ;
39493968 let indicator = create_tracking_python_indicator ( py) . unwrap ( ) ;
@@ -4002,6 +4021,7 @@ class IndicatorEventActor:
40024021 trader_id : TraderId ,
40034022 ) {
40044023 pyo3:: Python :: initialize ( ) ;
4024+
40054025 Python :: attach ( |py| {
40064026 let events = PyList :: empty ( py) ;
40074027 let py_actor = create_indicator_event_actor ( py, & events) . unwrap ( ) ;
@@ -4047,6 +4067,7 @@ class IndicatorEventActor:
40474067 #[ case] method_name : & str ,
40484068 ) {
40494069 pyo3:: Python :: initialize ( ) ;
4070+
40504071 Python :: attach ( |py| {
40514072 assert_python_dispatch ( py, clock, cache, trader_id, method_name, |rust_actor| {
40524073 match method_name {
@@ -4135,6 +4156,7 @@ class IndicatorEventActor:
41354156 #[ case] method_name : & str ,
41364157 ) {
41374158 pyo3:: Python :: initialize ( ) ;
4159+
41384160 Python :: attach ( |py| {
41394161 assert_python_dispatch ( py, clock, cache, trader_id, method_name, |rust_actor| {
41404162 match method_name {
@@ -4193,6 +4215,7 @@ class IndicatorEventActor:
41934215 #[ case] method_name : & str ,
41944216 ) {
41954217 pyo3:: Python :: initialize ( ) ;
4218+
41964219 Python :: attach ( |py| {
41974220 assert_python_dispatch ( py, clock, cache, trader_id, method_name, |rust_actor| {
41984221 match method_name {
@@ -4234,6 +4257,7 @@ class IndicatorEventActor:
42344257 audusd_sim : CurrencyPair ,
42354258 ) {
42364259 pyo3:: Python :: initialize ( ) ;
4260+
42374261 Python :: attach ( |py| {
42384262 let py_actor = create_tracking_python_actor ( py) . unwrap ( ) ;
42394263
@@ -4266,6 +4290,7 @@ class IndicatorEventActor:
42664290 trader_id : TraderId ,
42674291 ) {
42684292 pyo3:: Python :: initialize ( ) ;
4293+
42694294 Python :: attach ( |_py| {
42704295 let mut rust_actor = PyDataActor :: new ( None ) ;
42714296 rust_actor. register ( trader_id, clock, cache) . unwrap ( ) ;
@@ -4283,6 +4308,7 @@ class IndicatorEventActor:
42834308 trader_id : TraderId ,
42844309 ) {
42854310 pyo3:: Python :: initialize ( ) ;
4311+
42864312 let mut rust_actor = PyDataActor :: new ( None ) ;
42874313 rust_actor. register ( trader_id, clock, cache) . unwrap ( ) ;
42884314
0 commit comments