Skip to content

Commit d9026ed

Browse files
committed
Simplify test_set_role
1 parent 3368c82 commit d9026ed

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

tests/integration/test_dbapi_integration.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,8 +1036,7 @@ def test_use_schema(run_trino):
10361036
assert result[0][1] == 'sf1'
10371037

10381038

1039-
@pytest.mark.skipif(trino_version() == '351', reason="Newer Trino versions return the system role")
1040-
def test_set_role_trino_higher_351(run_trino):
1039+
def test_set_role(run_trino):
10411040
_, host, port = run_trino
10421041

10431042
trino_connection = trino.dbapi.Connection(
@@ -1050,24 +1049,11 @@ def test_set_role_trino_higher_351(run_trino):
10501049

10511050
cur.execute("SET ROLE ALL")
10521051
cur.fetchall()
1053-
assert_role_headers(cur, "system=ALL")
1054-
1055-
1056-
@pytest.mark.skipif(trino_version() != '351', reason="Trino 351 returns the role for the current catalog")
1057-
def test_set_role_trino_351(run_trino):
1058-
_, host, port = run_trino
1059-
1060-
trino_connection = trino.dbapi.Connection(
1061-
host=host, port=port, user="test", catalog="tpch"
1062-
)
1063-
cur = trino_connection.cursor()
1064-
cur.execute('SHOW TABLES FROM information_schema')
1065-
cur.fetchall()
1066-
assert cur._request._client_session.roles == {}
1067-
1068-
cur.execute("SET ROLE ALL")
1069-
cur.fetchall()
1070-
assert_role_headers(cur, "tpch=ALL")
1052+
if trino_version() == "351":
1053+
assert_role_headers(cur, "tpch=ALL")
1054+
else:
1055+
# Newer Trino versions return the system role
1056+
assert_role_headers(cur, "system=ALL")
10711057

10721058

10731059
@pytest.mark.skipif(trino_version() == '351', reason="Newer Trino versions return the system role")

0 commit comments

Comments
 (0)