Fix Python 3.8 compatibility test

Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Loren Eteval
2026-10-13 16:32:13 +08:00
parent 95782a4fa8
commit c58b92b449
+13 -10
View File
@@ -50,6 +50,7 @@ class PublicPackageAPITest(unittest.TestCase):
def testWindowsBuildUsesIndependentConstantsWithoutChangingHostEnvironment(self):
"""Apply the embedding fix only to the Windows compiler subprocess."""
script = """
from contextlib import ExitStack
from unittest import mock
from types import ModuleType
import os
@@ -59,18 +60,20 @@ import Deploy
for platform in ('Windows', 'Linux', 'Darwin'):
failure = subprocess.CalledProcessError(1, 'compiler', output=b'', stderr=b'')
with (
mock.patch.object(Deploy, 'PLATFORM', platform),
mock.patch.object(Deploy, 'runExternalCommand', side_effect=failure) as run,
mock.patch.object(Deploy, 'cleanup') as cleanup,
mock.patch.object(Deploy, 'download') as download,
mock.patch.object(sys, 'argv', ['Deploy.py']),
mock.patch.dict(sys.modules, {'nuitka': ModuleType('nuitka')}),
mock.patch.dict(os.environ, {
with ExitStack() as stack:
stack.enter_context(mock.patch.object(Deploy, 'PLATFORM', platform))
run = stack.enter_context(
mock.patch.object(Deploy, 'runExternalCommand', side_effect=failure)
)
cleanup = stack.enter_context(mock.patch.object(Deploy, 'cleanup'))
download = stack.enter_context(mock.patch.object(Deploy, 'download'))
stack.enter_context(mock.patch.object(sys, 'argv', ['Deploy.py']))
stack.enter_context(mock.patch.dict(sys.modules, {'nuitka': ModuleType('nuitka')}))
stack.enter_context(mock.patch.dict(os.environ, {
'NUITKA_RESOURCE_MODE': 'c23_embed',
'FURIOUS_BUILD_TEST_VALUE': 'preserved',
}),
):
}))
try:
Deploy.main()
except SystemExit as ex: