Skip to content

Commit

Permalink
Merge pull request #42 from ikalnytskyi/chore/no-server-locale
Browse files Browse the repository at this point in the history
Test database locale, not server variables
  • Loading branch information
ikalnytskyi authored Aug 8, 2024
2 parents 04051f8 + dddd46f commit 2686486
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions test_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,19 @@ def test_locale(connection: psycopg.Connection, is_windows_server_2019: bool):
if is_windows_server_2019:
locale_exp = "en-US"

lc_collate = connection.execute("SHOW LC_COLLATE").fetchone()[0]
lc_ctype = connection.execute("SHOW LC_CTYPE").fetchone()[0]

assert locale.normalize(lc_collate) == locale_exp
assert locale.normalize(lc_ctype) == locale_exp
record = connection \
.execute("SELECT datcollate, datctype FROM pg_database WHERE datname = 'template0'") \
.fetchone()
assert record
assert locale.normalize(record[0]) == locale_exp
assert locale.normalize(record[1]) == locale_exp

record = connection \
.execute("SELECT datcollate, datctype FROM pg_database WHERE datname = 'template1'") \
.fetchone()
assert record
assert locale.normalize(record[0]) == locale_exp
assert locale.normalize(record[1]) == locale_exp


def test_environment_variables(is_windows: bool):
Expand Down

0 comments on commit 2686486

Please sign in to comment.