@@ -25,8 +25,7 @@ def adb(*args, **kwargs):
2525
2626SENTRY_VERSION = "0.14.2"
2727
28- from .assertions import wait_for_daemon
29- from .cmake import cmake_option
28+ from .assertions import wait_for_daemon as _wait_for_daemon
3029
3130
3231def make_dsn (httpserver , auth = "uiaeosnrtdy" , id = 123456 , proxy_host = False ):
@@ -100,19 +99,18 @@ def extract_request(httpserver_log, cond):
10099 return (None , httpserver_log )
101100
102101
103- def run (cwd , exe , args , expect_failure = False , env = None , ** kwargs ):
102+ def run (
103+ cwd , exe , args , expect_failure = False , env = None , wait_for_daemon = False , ** kwargs
104+ ):
104105 if env is None :
105106 env = dict (os .environ )
106- should_wait_for_daemon = (
107- expect_failure and cmake_option (cwd , "SENTRY_BACKEND" ) == "native"
108- )
109107 if kwargs .get ("check" ):
110108 raise pytest .fail .Exception (
111109 "`check` is inferred from `expect_failure`, and should not be passed in the kwargs"
112110 )
113111 check = expect_failure == False
114112 __tracebackhide__ = True
115- started_at = time .time () if should_wait_for_daemon else None
113+ started_at = time .time ()
116114 if os .environ .get ("ANDROID_API" ):
117115 # older android emulators do not correctly pass down the returncode
118116 # so we basically echo the return code, and parse it manually
@@ -187,10 +185,10 @@ def run(cwd, exe, args, expect_failure=False, env=None, **kwargs):
187185 ]
188186 try :
189187 result = subprocess .run ([* cmd , * args ], cwd = cwd , env = env , check = check , ** kwargs )
190- if should_wait_for_daemon :
191- assert wait_for_daemon (
188+ if wait_for_daemon :
189+ assert _wait_for_daemon (
192190 cwd , started_at
193- ), "native crash daemon did not finish before timeout"
191+ ), "native crash daemon did not finish within timeout"
194192 if expect_failure :
195193 assert (
196194 result .returncode != 0
@@ -208,6 +206,18 @@ def run(cwd, exe, args, expect_failure=False, env=None, **kwargs):
208206 ) from None
209207
210208
209+ def run_native_crash (cwd , exe , args , env = None , ** kwargs ):
210+ return run (
211+ cwd ,
212+ exe ,
213+ args ,
214+ expect_failure = True ,
215+ env = env ,
216+ wait_for_daemon = True ,
217+ ** kwargs ,
218+ )
219+
220+
211221def check_output (* args , ** kwargs ):
212222 stdout = run (* args , stdout = subprocess .PIPE , ** kwargs ).stdout
213223 # capturing stdout on windows actually encodes "\n" as "\r\n", which we
0 commit comments