Commit d5d41a0 1 parent 60a5b7b commit d5d41a0 Copy full SHA for d5d41a0
File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 6
6
7
7
import pytest
8
8
9
+ import reflex .app
9
10
from reflex .config import environment
10
11
from reflex .testing import AppHarness , AppHarnessProd
11
12
@@ -76,3 +77,25 @@ def app_harness_env(request):
76
77
The AppHarness class to use for the test.
77
78
"""
78
79
return request .param
80
+
81
+
82
+ @pytest .fixture (autouse = True )
83
+ def raise_console_error (request , mocker ):
84
+ """Spy on calls to `console.error` used by the framework.
85
+
86
+ Help catch spurious error conditions that might otherwise go unnoticed.
87
+
88
+ If a test is marked with `ignore_console_error`, the spy will be ignored
89
+ after the test.
90
+
91
+ Args:
92
+ request: The pytest request object.
93
+ mocker: The pytest mocker object.
94
+
95
+ Yields:
96
+ control to the test function.
97
+ """
98
+ spy = mocker .spy (reflex .app .console , "error" )
99
+ yield
100
+ if "ignore_console_error" not in request .keywords :
101
+ spy .assert_not_called ()
Original file line number Diff line number Diff line change 13
13
14
14
from reflex .testing import AppHarness , AppHarnessProd
15
15
16
+ pytestmark = [pytest .mark .ignore_console_error ]
17
+
16
18
17
19
def TestApp ():
18
20
"""A test app for event exception handler integration."""
You can’t perform that action at this time.
0 commit comments