Enable Ruff PT021 (#86801)
This commit is contained in:
parent
8f74bff354
commit
e9543a7254
2 changed files with 5 additions and 6 deletions
|
@ -72,7 +72,7 @@ TRANSITION_CASES_FOR_TESTS = [None, 0, 1]
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True, scope="module")
|
@pytest.fixture(autouse=True, scope="module")
|
||||||
def setup(request):
|
def setup():
|
||||||
"""Set up patches for pytradfri methods."""
|
"""Set up patches for pytradfri methods."""
|
||||||
p_1 = patch(
|
p_1 = patch(
|
||||||
"pytradfri.device.LightControl.raw",
|
"pytradfri.device.LightControl.raw",
|
||||||
|
@ -83,12 +83,10 @@ def setup(request):
|
||||||
p_1.start()
|
p_1.start()
|
||||||
p_2.start()
|
p_2.start()
|
||||||
|
|
||||||
def teardown():
|
yield
|
||||||
"""Remove patches for pytradfri methods."""
|
|
||||||
p_1.stop()
|
|
||||||
p_2.stop()
|
|
||||||
|
|
||||||
request.addfinalizer(teardown)
|
p_1.stop()
|
||||||
|
p_2.stop()
|
||||||
|
|
||||||
|
|
||||||
async def generate_psk(self, code):
|
async def generate_psk(self, code):
|
||||||
|
|
|
@ -5,5 +5,6 @@ extend-select = [
|
||||||
"PT001", # Use @pytest.fixture without parentheses
|
"PT001", # Use @pytest.fixture without parentheses
|
||||||
"PT013", # Found incorrect pytest import, use simple import pytest instead
|
"PT013", # Found incorrect pytest import, use simple import pytest instead
|
||||||
"PT015", # Assertion always fails, replace with pytest.fail()
|
"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
|
"PT022", # No teardown in fixture, replace useless yield with return
|
||||||
]
|
]
|
Loading…
Add table
Reference in a new issue