@@ -159,9 +159,19 @@ def is_not_in_logs(self, pattern: str) -> bool:
159159
160160def _run_command (
161161 source : Source ,
162- args : list [str ],
163- expected_outcome : ExpectedOutcome ,
162+ args : List [str ],
163+ expecting_exception : bool | None = None , # Deprecated, use `expected_outcome` instead.
164+ * ,
165+ expected_outcome : ExpectedOutcome | None = None
164166) -> EntrypointOutput :
167+ """Internal function to run a command with the AirbyteEntrypoint.
168+
169+ Note: Even though this function is private, some connectors do call it directly.
170+
171+ Note: The `expecting_exception` arg is now deprecated in favor of the tri-state
172+ `expected_outcome` arg. The old argument is supported (for now) for backwards compatibility.
173+ """
174+ expected_outcome = expected_outcome or ExpectedOutcome .from_expecting_exception_bool (expecting_exception )
165175 log_capture_buffer = StringIO ()
166176 stream_handler = logging .StreamHandler (log_capture_buffer )
167177 stream_handler .setLevel (logging .INFO )
@@ -194,8 +204,9 @@ def _run_command(
194204def discover (
195205 source : Source ,
196206 config : Mapping [str , Any ],
207+ expecting_exception : bool | None = None , # Deprecated, use `expected_outcome` instead.
197208 * ,
198- expected_outcome : ExpectedOutcome = ExpectedOutcome . EXPECT_SUCCESS ,
209+ expected_outcome : ExpectedOutcome | None = None ,
199210) -> EntrypointOutput :
200211 """
201212 config must be json serializable
@@ -210,6 +221,7 @@ def discover(
210221 return _run_command (
211222 source ,
212223 ["discover" , "--config" , config_file , "--debug" ],
224+ expecting_exception = expecting_exception , # Deprecated, but still supported.
213225 expected_outcome = expected_outcome ,
214226 )
215227
@@ -219,8 +231,9 @@ def read(
219231 config : Mapping [str , Any ],
220232 catalog : ConfiguredAirbyteCatalog ,
221233 state : Optional [List [AirbyteStateMessage ]] = None ,
234+ expecting_exception : bool | None = None , # Deprecated, use `expected_outcome` instead.
222235 * ,
223- expected_outcome : ExpectedOutcome = ExpectedOutcome . EXPECT_SUCCESS ,
236+ expected_outcome : ExpectedOutcome | None = None ,
224237) -> EntrypointOutput :
225238 """
226239 config and state must be json serializable
@@ -253,7 +266,12 @@ def read(
253266 ]
254267 )
255268
256- return _run_command (source , args , expected_outcome = expected_outcome )
269+ return _run_command (
270+ source ,
271+ args ,
272+ expecting_exception = expecting_exception , # Deprecated, but still supported.
273+ expected_outcome = expected_outcome ,
274+ )
257275
258276
259277def make_file (
0 commit comments