mirror of
https://github.com/apache/superset.git
synced 2026-04-17 23:25:05 +00:00
chore: use contextlib.surpress instead of passing on error (#24896)
Co-authored-by: John Bodley <4567245+john-bodley@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
72150ebadf
commit
e585db85b6
@@ -14,6 +14,7 @@
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import contextlib
|
||||
from typing import Callable, ContextManager
|
||||
|
||||
import pytest
|
||||
@@ -42,20 +43,16 @@ def force_async_run(allow_run_async: bool):
|
||||
def non_async_example_db(app_context):
|
||||
gen = force_async_run(False)
|
||||
yield next(gen)
|
||||
try:
|
||||
with contextlib.suppress(StopIteration):
|
||||
next(gen)
|
||||
except StopIteration:
|
||||
pass
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def async_example_db(app_context):
|
||||
gen = force_async_run(True)
|
||||
yield next(gen)
|
||||
try:
|
||||
with contextlib.suppress(StopIteration):
|
||||
next(gen)
|
||||
except StopIteration:
|
||||
pass
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in New Issue
Block a user