Skip to content

Commit 2686486

Browse files
authored
Merge pull request #42 from ikalnytskyi/chore/no-server-locale
Test database locale, not server variables
2 parents 04051f8 + dddd46f commit 2686486

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)