diff --git a/poetry.lock b/poetry.lock index 69aae51..5ceada2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -364,6 +364,14 @@ python-versions = ">=3.7" docs = ["furo (>=2021.8.17b43)", "sphinx (>=4.1)", "sphinx-autodoc-typehints (>=1.12)"] testing = ["covdefaults (>=1.2.0)", "coverage (>=4)", "pytest (>=4)", "pytest-cov", "pytest-timeout (>=1.4.2)"] +[[package]] +name = "flaky" +version = "3.7.0" +description = "Plugin for nose or pytest that automatically reruns flaky tests." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" + [[package]] name = "greenlet" version = "1.1.2" @@ -1461,7 +1469,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "4a0d093b99ca03d9e9effe113ccd85daf9242c0a95f2336d2af8fcc7e764b6ce" +content-hash = "48207f450bd3f15faf69721a1b2daed6b15aa5e23ff94a6ab05036f37d844d73" [metadata.files] aiofiles = [ @@ -1645,6 +1653,10 @@ filelock = [ {file = "filelock-3.6.0-py3-none-any.whl", hash = "sha256:f8314284bfffbdcfa0ff3d7992b023d4c628ced6feb957351d4c48d059f56bc0"}, {file = "filelock-3.6.0.tar.gz", hash = "sha256:9cd540a9352e432c7246a48fe4e8712b10acb1df2ad1f30e8c070b82ae1fed85"}, ] +flaky = [ + {file = "flaky-3.7.0-py2.py3-none-any.whl", hash = "sha256:d6eda73cab5ae7364504b7c44670f70abed9e75f77dd116352f662817592ec9c"}, + {file = "flaky-3.7.0.tar.gz", hash = "sha256:3ad100780721a1911f57a165809b7ea265a7863305acb66708220820caf8aa0d"}, +] greenlet = [ {file = "greenlet-1.1.2-cp27-cp27m-macosx_10_14_x86_64.whl", hash = "sha256:58df5c2a0e293bf665a51f8a100d3e9956febfbf1d9aaf8c0677cf70218910c6"}, {file = "greenlet-1.1.2-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:aec52725173bd3a7b56fe91bc56eccb26fbdff1386ef123abb63c84c5b43b63a"}, diff --git a/pyproject.toml b/pyproject.toml index 1a2b388..1c9bf56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,6 +49,7 @@ black = "^22.1.0" isort = "^5.10.1" pre-commit = "^2.17.0" nb-cli = "^0.6.6" +flaky = "^3.7.0" [build-system] requires = ["poetry>=0.12"] diff --git a/tests/test_merge_pic.py b/tests/test_merge_pic.py index 9e1a34b..09b7a95 100644 --- a/tests/test_merge_pic.py +++ b/tests/test_merge_pic.py @@ -1,6 +1,7 @@ import typing import pytest +from flaky import flaky from nonebug.app import App if typing.TYPE_CHECKING: @@ -40,7 +41,7 @@ merge_source_9_2 = [ ] -@pytest.mark.asyncio +@flaky async def test_9_merge(app: App): from nonebot_bison.post import Post @@ -50,7 +51,7 @@ async def test_9_merge(app: App): await post.generate_messages() -@pytest.mark.asyncio +@flaky async def test_9_merge_2(app: App): from nonebot_bison.post import Post @@ -60,7 +61,7 @@ async def test_9_merge_2(app: App): await post.generate_messages() -@pytest.mark.asyncio +@flaky async def test_6_merge(app: App): from nonebot_bison.post import Post @@ -69,7 +70,7 @@ async def test_6_merge(app: App): assert len(post.pics) == 5 -@pytest.mark.asyncio +@flaky async def test_3_merge(app: App): from nonebot_bison.post import Post @@ -78,7 +79,7 @@ async def test_3_merge(app: App): assert len(post.pics) == 5 -@pytest.mark.asyncio +@flaky async def test_6_merge_only(app: App): from nonebot_bison.post import Post @@ -87,7 +88,7 @@ async def test_6_merge_only(app: App): assert len(post.pics) == 1 -@pytest.mark.asyncio +@flaky async def test_3_merge_only(app: App): from nonebot_bison.post import Post