From a0843d15c1e26ded7e25475239c15359c738ee9e Mon Sep 17 00:00:00 2001 From: ptiurin Date: Mon, 15 May 2023 14:18:23 +0100 Subject: [PATCH 1/2] test: Remove rowcount check on create query --- .../integration/dbapi/async/test_queries_async.py | 2 -- tests/integration/dbapi/sync/test_queries.py | 14 +++----------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/tests/integration/dbapi/async/test_queries_async.py b/tests/integration/dbapi/async/test_queries_async.py index 90c1b665e9d..234ba98d6a9 100644 --- a/tests/integration/dbapi/async/test_queries_async.py +++ b/tests/integration/dbapi/async/test_queries_async.py @@ -201,8 +201,6 @@ async def test_drop_create( """Create and drop table/index queries are handled properly.""" async def test_query(c: Cursor, query: str) -> None: - assert await c.execute(query) == 1, "Invalid row count returned" - assert c.rowcount == 1, "Invalid rowcount value" assert_deep_eq( c.description, create_drop_description, diff --git a/tests/integration/dbapi/sync/test_queries.py b/tests/integration/dbapi/sync/test_queries.py index a409dea4729..b9aa6f9c78b 100644 --- a/tests/integration/dbapi/sync/test_queries.py +++ b/tests/integration/dbapi/sync/test_queries.py @@ -146,20 +146,12 @@ def test_long_query( assert len(data) == 360, "Invalid data size returned by fetchall" -def test_drop_create( - connection: Connection, create_drop_description: List[Column] -) -> None: +def test_drop_create(connection: Connection) -> None: """Create and drop table/index queries are handled properly.""" def test_query(c: Cursor, query: str) -> None: - assert c.execute(query) == 1, "Invalid row count returned" - assert c.rowcount == 1, "Invalid rowcount value" - assert_deep_eq( - c.description, - create_drop_description, - "Invalid create table query description", - ) - assert len(c.fetchall()) == 1, "Invalid data returned" + assert c.description == None + assert c.rowcount == -1 """Create table query is handled properly""" with connection.cursor() as c: From 10943c7d58e0f482a3f6fb93840d01d78c37b36d Mon Sep 17 00:00:00 2001 From: ptiurin Date: Mon, 15 May 2023 14:31:55 +0100 Subject: [PATCH 2/2] add execute --- tests/integration/dbapi/async/test_queries_async.py | 13 ++++--------- tests/integration/dbapi/sync/test_queries.py | 1 + 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/integration/dbapi/async/test_queries_async.py b/tests/integration/dbapi/async/test_queries_async.py index 234ba98d6a9..3fd749a7ad9 100644 --- a/tests/integration/dbapi/async/test_queries_async.py +++ b/tests/integration/dbapi/async/test_queries_async.py @@ -195,18 +195,13 @@ async def test_long_query( assert len(data) == 360, "Invalid data size returned by fetchall" -async def test_drop_create( - connection: Connection, create_drop_description: List[Column] -) -> None: +async def test_drop_create(connection: Connection) -> None: """Create and drop table/index queries are handled properly.""" async def test_query(c: Cursor, query: str) -> None: - assert_deep_eq( - c.description, - create_drop_description, - "Invalid create table query description", - ) - assert len(await c.fetchall()) == 1, "Invalid data returned" + await c.execute(query) + assert c.description == None + assert c.rowcount == -1 """Create table query is handled properly""" with connection.cursor() as c: diff --git a/tests/integration/dbapi/sync/test_queries.py b/tests/integration/dbapi/sync/test_queries.py index b9aa6f9c78b..8af7f781984 100644 --- a/tests/integration/dbapi/sync/test_queries.py +++ b/tests/integration/dbapi/sync/test_queries.py @@ -150,6 +150,7 @@ def test_drop_create(connection: Connection) -> None: """Create and drop table/index queries are handled properly.""" def test_query(c: Cursor, query: str) -> None: + c.execute(query) assert c.description == None assert c.rowcount == -1