Skip to content

Commit

Permalink
Remove unnecessary pytest.mark.asyncio by using aysncio_mode = auto (#21
Browse files Browse the repository at this point in the history
)

This PR removes unnecessary pytest asyncio markers by using
`asyncio_mode=auto` configurations for the pytest-asyncio plugin such
that aync tests are automatically discovered.

This PR also specifies the minimum versions for pytest and
pytest-asyncio for `asyncio_mode=auto` support.
  • Loading branch information
yuxincs authored Nov 27, 2023
1 parent 88591b7 commit 0ccdf7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ dependencies = []

[project.optional-dependencies]
dev = [
"pytest",
"pytest>=6.0",
"pytest-cov",
"pytest-asyncio",
"pytest-asyncio>=0.17",
]

[build-system]
Expand All @@ -31,6 +31,10 @@ build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
where = ["src"]

[tool.pytest.ini_options]
minversion = "6.0"
asyncio_mode = "auto"

[tool.black]
line-length = 99
target-version = ["py38"]
Expand Down
2 changes: 0 additions & 2 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from . import PARSED_DICT, SAMPLE_STATUS


@pytest.mark.asyncio
async def test_request_status():
"""Test top-level API request_status."""
with patch(
Expand All @@ -19,7 +18,6 @@ async def test_request_status():
mock_request_raw_status.assert_called_once_with("testhost", 4242)


@pytest.mark.asyncio
async def test_request_raw_status():
"""Test requesting raw status from apcupsd NIC."""
with patch("asyncio.open_connection") as mock_open_connection:
Expand Down

0 comments on commit 0ccdf7a

Please sign in to comment.