Skip to content

Commit 4c31284

Browse files
committed
Fix tests on Python 3.12
We were seeing the following test failures on Python 3.12: openstackclient.tests.unit.common.test_module.TestModuleList.test_module_list_all openstackclient.tests.unit.common.test_module.TestModuleList.test_module_list_no_options Both failures were caused by missing attributes of 'sys', e.g. AttributeError: module 'sys' has no attribute 'builtin_module_names' Fix this by exposing the real 'sys' module as part of our mock of 'sys.modules'. Change-Id: I17391a46f08896f49dccaf75ad685dab1375a03d Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
1 parent 5e5b89f commit 4c31284

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

openstackclient/tests/unit/common/test_module.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
"""Test module module"""
1717

18+
import sys
1819
from unittest import mock
1920

2021
from openstackclient.common import module as osc_module
@@ -43,6 +44,7 @@
4344
module_version_5 = '0.0.1'
4445

4546
MODULES = {
47+
'sys': sys,
4648
module_name_1: fakes.FakeModule(module_name_1, module_version_1),
4749
module_name_2: fakes.FakeModule(module_name_2, module_version_2),
4850
module_name_3: fakes.FakeModule(module_name_3, module_version_3),

0 commit comments

Comments
 (0)