summaryrefslogtreecommitdiff
path: root/Lib/test/libregrtest/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/libregrtest/setup.py')
-rw-r--r--Lib/test/libregrtest/setup.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/libregrtest/setup.py b/Lib/test/libregrtest/setup.py
index b79175944d..0bfd644bb3 100644
--- a/Lib/test/libregrtest/setup.py
+++ b/Lib/test/libregrtest/setup.py
@@ -5,6 +5,7 @@ import signal
import sys
import unittest
from test import support
+from test.support.os_helper import TESTFN_UNDECODABLE, FS_NONASCII
try:
import gc
except ImportError:
@@ -105,10 +106,10 @@ def setup_tests(ns):
# Ensure there's a non-ASCII character in env vars at all times to force
# tests consider this case. See BPO-44647 for details.
- os.environ.setdefault(
- UNICODE_GUARD_ENV,
- "\N{SMILING FACE WITH SUNGLASSES}",
- )
+ if TESTFN_UNDECODABLE and os.supports_bytes_environ:
+ os.environb.setdefault(UNICODE_GUARD_ENV.encode(), TESTFN_UNDECODABLE)
+ elif FS_NONASCII:
+ os.environ.setdefault(UNICODE_GUARD_ENV, FS_NONASCII)
def replace_stdout():