Skip to content

Commit 553d606

Browse files
New test requires AL32UTF8 to work correctly -- add that check and since
it is done in quite a few places now, include it in the test library.
1 parent 261dcd0 commit 553d606

File tree

5 files changed

+44
-30
lines changed

5 files changed

+44
-30
lines changed

tests/test_1900_lob_var.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2020, 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -417,15 +417,7 @@ def test_1919_assign_string_beyond_array_size(self):
417417

418418
def test_1920_supplemental_characters(self):
419419
"1920 - test read/write temporary LOBs using supplemental characters"
420-
self.cursor.execute(
421-
"""
422-
select value
423-
from nls_database_parameters
424-
where parameter = 'NLS_CHARACTERSET'
425-
"""
426-
)
427-
(charset,) = self.cursor.fetchone()
428-
if charset != "AL32UTF8":
420+
if test_env.get_charset() != "AL32UTF8":
429421
self.skipTest("Database character set must be AL32UTF8")
430422
supplemental_chars = (
431423
"𠜎 𠜱 𠝹 𠱓 𠱸 𠲖 𠳏 𠳕 𠴕 𠵼 𠵿 𠸎 𠸏 𠹷 𠺝 𠺢 𠻗 𠻹 𠻺 𠼭 𠼮 "

tests/test_2500_string_var.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2020, 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -382,15 +382,7 @@ def test_2525_fetchone(self):
382382

383383
def test_2526_supplemental_characters(self):
384384
"2526 - test binding and fetching supplemental charcters"
385-
self.cursor.execute(
386-
"""
387-
select value
388-
from nls_database_parameters
389-
where parameter = 'NLS_CHARACTERSET'
390-
"""
391-
)
392-
(charset,) = self.cursor.fetchone()
393-
if charset != "AL32UTF8":
385+
if test_env.get_charset() != "AL32UTF8":
394386
self.skipTest("Database character set must be AL32UTF8")
395387
supplemental_chars = (
396388
"𠜎 𠜱 𠝹 𠱓 𠱸 𠲖 𠳏 𠳕 𠴕 𠵼 𠵿 𠸎 𠸏 "

tests/test_3800_typehandler.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ def output_type_handler(cursor, metadata):
284284
def test_3807(self):
285285
"3807 - output type handler for encoding errors"
286286

287+
if test_env.get_charset() != "AL32UTF8":
288+
self.skipTest("Database character set must be AL32UTF8")
289+
287290
def output_type_handler(cursor, metadata):
288291
if metadata.type_code is oracledb.DB_TYPE_VARCHAR:
289292
return cursor.var(

tests/test_5700_lob_var_async.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2023, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -382,14 +382,7 @@ async def test_5715_temporary_lobs(self):
382382

383383
async def test_5716_supplemental_characters(self):
384384
"5716 - test read/write temporary LOBs using supplemental characters"
385-
await self.cursor.execute(
386-
"""
387-
select value
388-
from nls_database_parameters
389-
where parameter = 'NLS_CHARACTERSET'
390-
"""
391-
)
392-
(charset,) = await self.cursor.fetchone()
385+
charset = await test_env.get_charset_async()
393386
if charset != "AL32UTF8":
394387
self.skipTest("Database character set must be AL32UTF8")
395388
supplemental_chars = (

tests/test_env.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -----------------------------------------------------------------------------
2-
# Copyright (c) 2020, 2023, Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2024, Oracle and/or its affiliates.
33
#
44
# This software is dual-licensed to you under the Universal Permissive License
55
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
@@ -129,6 +129,40 @@ async def get_admin_connection_async(use_async=False):
129129
return await get_admin_connection(use_async=True)
130130

131131

132+
def get_charset():
133+
value = PARAMETERS.get("CHARSET")
134+
if value is None:
135+
with get_connection() as conn:
136+
with conn.cursor() as cursor:
137+
cursor.execute(
138+
"""
139+
select value
140+
from nls_database_parameters
141+
where parameter = 'NLS_CHARACTERSET'
142+
"""
143+
)
144+
(value,) = cursor.fetchone()
145+
PARAMETERS["CHARSET"] = value
146+
return value
147+
148+
149+
async def get_charset_async():
150+
value = PARAMETERS.get("CHARSET")
151+
if value is None:
152+
async with get_connection_async() as conn:
153+
with conn.cursor() as cursor:
154+
await cursor.execute(
155+
"""
156+
select value
157+
from nls_database_parameters
158+
where parameter = 'NLS_CHARACTERSET'
159+
"""
160+
)
161+
(value,) = await cursor.fetchone()
162+
PARAMETERS["CHARSET"] = value
163+
return value
164+
165+
132166
def get_charset_ratios():
133167
value = PARAMETERS.get("CS_RATIO")
134168
if value is None:

0 commit comments

Comments
 (0)