ref: Make some functions that don't await non-async (RUF029) (#4368)

Make some functions that don't await non-async (RUF029)
This commit is contained in:
Christophe Bornet 2024-11-03 17:42:06 +01:00 • committed by GitHub
commit 10e1352ac4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 26 additions and 25 deletions

View file

@ -85,10 +85,10 @@ def _wrap_file_read_blocking(func):
for frame_info in inspect.stack():
if isinstance(frame_info.frame.f_locals.get("self"), FileLoader):
return func(self, *args, **kwargs)
if frame_info.filename.endswith("_pytest/assertion/rewrite.py") and frame_info.function in [
if frame_info.filename.endswith("_pytest/assertion/rewrite.py") and frame_info.function in {
"_rewrite_test",
"_read_pyc",
]:
}:
return func(self, *args, **kwargs)
raise _blocking_error(func)
@ -104,7 +104,7 @@ def _wrap_file_write_blocking(func):
for frame_info in inspect.stack():
if frame_info.filename.endswith("_pytest/assertion/rewrite.py") and frame_info.function == "_write_pyc":
return func(self, *args, **kwargs)
if self not in [sys.stdout, sys.stderr]:
if self not in {sys.stdout, sys.stderr}:
raise _blocking_error(func)
return func(self, *args, **kwargs)

View file

@ -7,7 +7,7 @@ from httpx import AsyncClient
@pytest.fixture
async def body():
def body():
return {
"name": "test_variable",
"value": "test_value",

View file

@ -11,7 +11,7 @@ from langflow.services.deps import session_scope
@pytest.fixture
async def created_message():
def created_message():
with session_scope() as session:
message = MessageCreate(text="Test message", sender="User", sender_name="User", session_id="session_id")
messagetable = MessageTable.model_validate(message, from_attributes=True)

View file

@ -155,7 +155,7 @@ async def test_inactive_user(client: AsyncClient):
@pytest.mark.api_key_required
async def test_add_user(test_user):
def test_add_user(test_user):
assert test_user["username"] == "testuser"