Skip to content

Commit 1dfacb2

Browse files
committed
add global flaky marker for github CI
1 parent 8b55754 commit 1dfacb2

File tree

6 files changed

+17
-21
lines changed

6 files changed

+17
-21
lines changed

tests/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import pytest
2+
3+
from reactpy.testing import GITHUB_ACTIONS
4+
5+
pytestmark = [pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)]

tests/test_asgi/test_middleware.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
from reactpy.executors.asgi.middleware import ReactPyMiddleware
1616
from reactpy.testing import BackendFixture, DisplayFixture
1717

18+
from .. import pytestmark # noqa: F401
19+
1820

1921
@pytest.fixture(scope="module")
2022
async def display(browser):

tests/test_asgi/test_pyscript.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from reactpy.executors.asgi.pyscript import ReactPyCsr
1313
from reactpy.testing import BackendFixture, DisplayFixture
1414

15+
from .. import pytestmark # noqa: F401
16+
1517

1618
@pytest.fixture(scope="module")
1719
async def display(browser):

tests/test_asgi/test_standalone.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from reactpy.testing.common import REACTPY_TESTS_DEFAULT_TIMEOUT
1414
from reactpy.types import Connection, Location
1515

16+
from .. import pytestmark # noqa: F401
17+
1618

1719
async def test_display_simple_hello_world(display: DisplayFixture):
1820
@reactpy.component

tests/test_reactjs/test_modules_from_npm.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import reactpy
55
from reactpy import html
66
from reactpy.reactjs import component_from_npm, import_reactjs
7-
from reactpy.testing import GITHUB_ACTIONS, BackendFixture, DisplayFixture
7+
from reactpy.testing import BackendFixture, DisplayFixture
8+
9+
from .. import pytestmark # noqa: F401
810

911
MISSING_IMPORT_MAP_MSG = "ReactPy did not detect a suitable JavaScript import map"
1012

@@ -17,7 +19,6 @@ async def display(browser):
1719
yield new_display
1820

1921

20-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
2122
async def test_component_from_npm_react_bootstrap(display: DisplayFixture, caplog):
2223
Button = component_from_npm("react-bootstrap", "Button", version="2")
2324

@@ -39,7 +40,6 @@ def App():
3940
assert MISSING_IMPORT_MAP_MSG not in " ".join(x.msg for x in caplog.records)
4041

4142

42-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
4343
async def test_component_from_npm_react_bootstrap_with_local_framework(browser, caplog):
4444
Button = component_from_npm("react-bootstrap", "Button", version="2")
4545

@@ -65,7 +65,6 @@ def App():
6565
assert MISSING_IMPORT_MAP_MSG not in " ".join(x.msg for x in caplog.records)
6666

6767

68-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
6968
async def test_component_from_npm_without_explicit_reactjs_import(browser, caplog):
7069
Button = component_from_npm("react-bootstrap", "Button", version="2")
7170

@@ -89,7 +88,6 @@ def App():
8988
assert MISSING_IMPORT_MAP_MSG in " ".join(x.msg for x in caplog.records)
9089

9190

92-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
9391
async def test_component_from_npm_material_ui(display: DisplayFixture):
9492
Button = component_from_npm("@mui/material", "Button", version="7")
9593

@@ -105,7 +103,6 @@ def App():
105103
await expect(button).to_contain_class("MuiButton-root")
106104

107105

108-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
109106
async def test_component_from_npm_antd(display: DisplayFixture):
110107
Button = component_from_npm("antd", "Button", version="6")
111108

@@ -119,7 +116,6 @@ def App():
119116
await expect(button).to_contain_class("ant-btn")
120117

121118

122-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
123119
async def test_component_from_npm_chakra_ui(display: DisplayFixture):
124120
ChakraProvider, _, Button = _get_chakra_components()
125121

@@ -135,7 +131,6 @@ def App():
135131
await expect(button).to_contain_class("chakra-button")
136132

137133

138-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
139134
async def test_component_from_npm_semantic_ui_react(browser):
140135
# Semantic UI is deprecated and doesn't get updates. Thus, it is incompatible with the
141136
# latest React versions. We use this as an opportunity to test Preact here.
@@ -156,7 +151,6 @@ def App():
156151
await expect(button).to_contain_class("button")
157152

158153

159-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
160154
async def test_component_from_npm_mantine(display: DisplayFixture):
161155
MantineProvider, Button = component_from_npm(
162156
"@mantine/core", ["MantineProvider", "Button"], version="8"
@@ -172,7 +166,6 @@ def App():
172166
await expect(button).to_contain_class("mantine-Button-root")
173167

174168

175-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
176169
async def test_component_from_npm_fluent_ui(display: DisplayFixture):
177170
PrimaryButton = component_from_npm("@fluentui/react", "PrimaryButton", version="8")
178171

@@ -186,7 +179,6 @@ def App():
186179
await expect(button).to_contain_class("ms-Button")
187180

188181

189-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
190182
async def test_component_from_npm_blueprint(display: DisplayFixture):
191183
Button = component_from_npm("@blueprintjs/core", "Button", version="6")
192184

@@ -200,7 +192,6 @@ def App():
200192
await expect(button).to_contain_class("bp6-button")
201193

202194

203-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
204195
async def test_component_from_npm_grommet(display: DisplayFixture):
205196
Grommet, Button = component_from_npm("grommet", ["Grommet", "Button"], version="2")
206197

@@ -215,7 +206,6 @@ def App():
215206
await expect(button).to_have_text("Click me")
216207

217208

218-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
219209
async def test_component_from_npm_evergreen(display: DisplayFixture):
220210
Button = component_from_npm("evergreen-ui", "Button", version="7")
221211

@@ -228,7 +218,6 @@ def App():
228218
await expect(button).to_have_text("Click me")
229219

230220

231-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
232221
async def test_component_from_npm_react_spinners(display: DisplayFixture):
233222
ClipLoader = component_from_npm("react-spinners", "ClipLoader", version="0.17.0")
234223

@@ -251,7 +240,6 @@ def App():
251240
await expect(loader).to_be_visible()
252241

253242

254-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
255243
async def test_nested_npm_components(display: DisplayFixture):
256244
ChakraProvider, Box, _ = _get_chakra_components()
257245
BootstrapButton = component_from_npm("react-bootstrap", "Button", version="2")
@@ -283,7 +271,6 @@ def App():
283271
await expect(button).to_contain_class("btn")
284272

285273

286-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
287274
async def test_interleaved_npm_and_server_components(display: DisplayFixture):
288275
Card = component_from_npm("antd", "Card", version="6")
289276
Button = component_from_npm("@mui/material", "Button", version="7")
@@ -316,7 +303,6 @@ def App():
316303
await expect(button).to_have_css("text-transform", "uppercase")
317304

318305

319-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
320306
async def test_complex_nested_material_ui(display: DisplayFixture):
321307
mui_components = component_from_npm(
322308
"@mui/material",

tests/test_widgets.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from base64 import b64encode
22
from pathlib import Path
33

4-
import pytest
5-
64
import reactpy
7-
from reactpy.testing import GITHUB_ACTIONS, DisplayFixture, poll
5+
from reactpy.testing import DisplayFixture, poll
86
from tests.tooling.common import DEFAULT_TYPE_DELAY
97

8+
from . import pytestmark # noqa: F401
9+
1010
HERE = Path(__file__).parent
1111

1212

@@ -110,7 +110,6 @@ def SomeComponent():
110110
await poll_value.until_equals(12)
111111

112112

113-
@pytest.mark.flaky(reruns=10 if GITHUB_ACTIONS else 1)
114113
async def test_use_linked_inputs_ignore_empty(display: DisplayFixture):
115114
value = reactpy.Ref(None)
116115

0 commit comments

Comments
 (0)