Skip to content

Commit dddd46f

Browse files
committed
Test database locale, not server variables
In PostgreSQL 16, both `LC_COLLATE` and `LC_CTYPE` server variables have been removed. This patch rewrites one test that checks their values in order to make tests compatible with PostgreSQL 16, which is shipped with Ubuntu 24.04 runners. Reported-by: Yuri Astrakhan Resolves: #38
1 parent 04051f8 commit dddd46f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

test_action.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,19 @@ def test_locale(connection: psycopg.Connection, is_windows_server_2019: bool):
101101
if is_windows_server_2019:
102102
locale_exp = "en-US"
103103

104-
lc_collate = connection.execute("SHOW LC_COLLATE").fetchone()[0]
105-
lc_ctype = connection.execute("SHOW LC_CTYPE").fetchone()[0]
106-
107-
assert locale.normalize(lc_collate) == locale_exp
108-
assert locale.normalize(lc_ctype) == locale_exp
104+
record = connection \
105+
.execute("SELECT datcollate, datctype FROM pg_database WHERE datname = 'template0'") \
106+
.fetchone()
107+
assert record
108+
assert locale.normalize(record[0]) == locale_exp
109+
assert locale.normalize(record[1]) == locale_exp
110+
111+
record = connection \
112+
.execute("SELECT datcollate, datctype FROM pg_database WHERE datname = 'template1'") \
113+
.fetchone()
114+
assert record
115+
assert locale.normalize(record[0]) == locale_exp
116+
assert locale.normalize(record[1]) == locale_exp
109117

110118

111119
def test_environment_variables(is_windows: bool):

0 commit comments

Comments
 (0)