Enable Ruff PT021 (#86801)

This commit is contained in:
Franck Nijhof 2023-01-27 17:14:04 +01:00 committed by GitHub
parent 8f74bff354
commit e9543a7254
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View file

@ -72,7 +72,7 @@ TRANSITION_CASES_FOR_TESTS = [None, 0, 1]
@pytest.fixture(autouse=True, scope="module")
def setup(request):
def setup():
"""Set up patches for pytradfri methods."""
p_1 = patch(
"pytradfri.device.LightControl.raw",
@ -83,13 +83,11 @@ def setup(request):
p_1.start()
p_2.start()
def teardown():
"""Remove patches for pytradfri methods."""
yield
p_1.stop()
p_2.stop()
request.addfinalizer(teardown)
async def generate_psk(self, code):
"""Mock psk."""

View file

@ -5,5 +5,6 @@ extend-select = [
"PT001", # Use @pytest.fixture without parentheses
"PT013", # Found incorrect pytest import, use simple import pytest instead
"PT015", # Assertion always fails, replace with pytest.fail()
"PT021", # use yield instead of request.addfinalizer
"PT022", # No teardown in fixture, replace useless yield with return
]