@@ -65,7 +65,7 @@ def __init__(
65
65
configuration : Configuration | None = None ,
66
66
* ,
67
67
configure_logging : bool = True ,
68
- call_exit : bool | None = None ,
68
+ exit_process : bool | None = None ,
69
69
) -> None :
70
70
"""Create an Actor instance.
71
71
@@ -76,10 +76,10 @@ def __init__(
76
76
configuration: The Actor configuration to be used. If not passed, a new Configuration instance will
77
77
be created.
78
78
configure_logging: Should the default logging configuration be configured?
79
- call_exit : Whether the Actor should call `sys.exit` when the context manager exits. The default is
79
+ exit_process : Whether the Actor should call `sys.exit` when the context manager exits. The default is
80
80
True except for the IPython, Pytest and Scrapy environments.
81
81
"""
82
- self ._call_exit = self ._get_default_call_exit () if call_exit is None else call_exit
82
+ self ._exit_process = self ._get_default_exit_process () if exit_process is None else exit_process
83
83
self ._is_exiting = False
84
84
85
85
self ._configuration = configuration or Configuration .get_global_configuration ()
@@ -151,13 +151,13 @@ def __call__(
151
151
configuration : Configuration | None = None ,
152
152
* ,
153
153
configure_logging : bool = True ,
154
- call_exit : bool | None = None ,
154
+ exit_process : bool | None = None ,
155
155
) -> Self :
156
156
"""Make a new Actor instance with a non-default configuration."""
157
157
return self .__class__ (
158
158
configuration = configuration ,
159
159
configure_logging = configure_logging ,
160
- call_exit = call_exit ,
160
+ exit_process = exit_process ,
161
161
)
162
162
163
163
@property
@@ -296,7 +296,7 @@ async def finalize() -> None:
296
296
await asyncio .wait_for (finalize (), cleanup_timeout .total_seconds ())
297
297
self ._is_initialized = False
298
298
299
- if self ._call_exit :
299
+ if self ._exit_process :
300
300
sys .exit (exit_code )
301
301
302
302
async def fail (
@@ -1137,22 +1137,22 @@ async def create_proxy_configuration(
1137
1137
1138
1138
return proxy_configuration
1139
1139
1140
- def _get_default_call_exit (self ) -> bool :
1140
+ def _get_default_exit_process (self ) -> bool :
1141
1141
"""Returns False for IPython, Pytest, and Scrapy environments, True otherwise."""
1142
1142
if is_running_in_ipython ():
1143
- self .log .debug ('Running in IPython, setting default `call_exit ` to False.' )
1143
+ self .log .debug ('Running in IPython, setting default `exit_process ` to False.' )
1144
1144
return False
1145
1145
1146
1146
# Check if running in Pytest by detecting the relevant environment variable.
1147
1147
if os .getenv ('PYTEST_CURRENT_TEST' ):
1148
- self .log .debug ('Running in Pytest, setting default `call_exit ` to False.' )
1148
+ self .log .debug ('Running in Pytest, setting default `exit_process ` to False.' )
1149
1149
return False
1150
1150
1151
1151
# Check if running in Scrapy by attempting to import it.
1152
1152
with suppress (ImportError ):
1153
1153
import scrapy # noqa: F401
1154
1154
1155
- self .log .debug ('Running in Scrapy, setting default `call_exit ` to False.' )
1155
+ self .log .debug ('Running in Scrapy, setting default `exit_process ` to False.' )
1156
1156
return False
1157
1157
1158
1158
return True
0 commit comments