-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
875255c
commit 567f4b7
Showing
2 changed files
with
56 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
python_modules/libraries/dagster-airbyte/dagster_airbyte_tests/experimental/utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from contextlib import contextmanager | ||
from typing import Optional, Type | ||
|
||
import pytest | ||
|
||
|
||
@contextmanager | ||
def optional_pytest_raise( | ||
error_expected: bool, exception_cls: Type[Exception], exception_message: Optional[str] = None | ||
): | ||
if error_expected: | ||
kwargs = {} | ||
if exception_message: | ||
kwargs["match"] = exception_message | ||
with pytest.raises(exception_cls, **kwargs): | ||
yield | ||
else: | ||
yield |