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(
11401140 def _get_default_call_exit (self ) -> bool :
11411141 """Returns False for IPython, Pytest, and Scrapy environments, True otherwise."""
11421142 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.' )
11441144 return False
11451145
1146+ # Check if running in Pytest by detecting the relevant environment variable.
11461147 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.' )
11481149 return False
11491150
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.
11551152 with suppress (ImportError ):
11561153 import scrapy # noqa: F401
11571154
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.' )
11591156 return False
11601157
11611158 return True
You can’t perform that action at this time.
0 commit comments