raise_console_error during integration tests (#4535)
This commit is contained in:
parent
60a5b7bc7a
commit
d5d41a0d9e
@ -6,6 +6,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
import reflex.app
|
||||||
from reflex.config import environment
|
from reflex.config import environment
|
||||||
from reflex.testing import AppHarness, AppHarnessProd
|
from reflex.testing import AppHarness, AppHarnessProd
|
||||||
|
|
||||||
@ -76,3 +77,25 @@ def app_harness_env(request):
|
|||||||
The AppHarness class to use for the test.
|
The AppHarness class to use for the test.
|
||||||
"""
|
"""
|
||||||
return request.param
|
return request.param
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def raise_console_error(request, mocker):
|
||||||
|
"""Spy on calls to `console.error` used by the framework.
|
||||||
|
|
||||||
|
Help catch spurious error conditions that might otherwise go unnoticed.
|
||||||
|
|
||||||
|
If a test is marked with `ignore_console_error`, the spy will be ignored
|
||||||
|
after the test.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
request: The pytest request object.
|
||||||
|
mocker: The pytest mocker object.
|
||||||
|
|
||||||
|
Yields:
|
||||||
|
control to the test function.
|
||||||
|
"""
|
||||||
|
spy = mocker.spy(reflex.app.console, "error")
|
||||||
|
yield
|
||||||
|
if "ignore_console_error" not in request.keywords:
|
||||||
|
spy.assert_not_called()
|
||||||
|
@ -13,6 +13,8 @@ from selenium.webdriver.support.ui import WebDriverWait
|
|||||||
|
|
||||||
from reflex.testing import AppHarness, AppHarnessProd
|
from reflex.testing import AppHarness, AppHarnessProd
|
||||||
|
|
||||||
|
pytestmark = [pytest.mark.ignore_console_error]
|
||||||
|
|
||||||
|
|
||||||
def TestApp():
|
def TestApp():
|
||||||
"""A test app for event exception handler integration."""
|
"""A test app for event exception handler integration."""
|
||||||
|
Loading…
Reference in New Issue
Block a user