File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -1140,22 +1140,19 @@ async def create_proxy_configuration(
1140
1140
def _get_default_call_exit (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 ('Actor is running in IPython, setting default call exit to False.' )
1143
+ self .log .debug ('Running in IPython, setting default `call_exit` to False.' )
1144
1144
return False
1145
1145
1146
+ # Check if running in Pytest by detecting the relevant environment variable.
1146
1147
if os .getenv ('PYTEST_CURRENT_TEST' ):
1147
- self .log .debug ('Actor is running in Pytest, setting default call exit to False.' )
1148
+ self .log .debug ('Running in Pytest, setting default `call_exit` to False.' )
1148
1149
return False
1149
1150
1150
- if os .getenv ('SCRAPY_SETTINGS_MODULE' ):
1151
- self .log .debug ('Actor is running in Scrapy, setting default call exit to False.' )
1152
- return False
1153
-
1154
- # Scrapy setting env var alone may not be sufficient; verify by attempting to import Scrapy.
1151
+ # Check if running in Scrapy by attempting to import it.
1155
1152
with suppress (ImportError ):
1156
1153
import scrapy # noqa: F401
1157
1154
1158
- self .log .debug ('Actor is running in Scrapy, setting default call exit to False.' )
1155
+ self .log .debug ('Running in Scrapy, setting default `call_exit` to False.' )
1159
1156
return False
1160
1157
1161
1158
return True
You can’t perform that action at this time.
0 commit comments