CI tests fix for Python 3.13
We should not unimport pathlib when we use pathlib.
This was always fragile. Choose a module we don't use:
The failure:
______________________ test_modules_from_files_are_found _______________________
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_modules_from_files_are_fo0')
def test_modules_from_files_are_found(tmp_path):
test_file_1 = tmp_path / 'this_is_a_file_in_tmp_path_1.txt'
test_file_2 = tmp_path / 'this_is_a_file_in_tmp_path_2.txt'
test_file_3 = tmp_path / 'this_is_a_file_in_tmp_path_3.txt'
test_file_1.write_text('math\nwave\n')
test_file_2.write_text('csv\npathlib\n')
test_file_3.write_text('logging\ncsv\n')
# Make sure the tested modules are not already in sys.modules
for m in ('math', 'wave', 'csv', 'pathlib', 'logging'):
sys.modules.pop(m, None)
> modules_main(['-f', str(test_file_1), '-f', str(test_file_2), '-f', str(test_file_3), ])
test_import_all_modules.py:170:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/rpm/redhat/import_all_modules.py:167: in main
import_modules(modules)
/usr/lib/rpm/redhat/import_all_modules.py💯 in import_modules
importlib.import_module(module)
/usr/lib64/python3.13/importlib/__init__.py:88: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
???
<frozen importlib._bootstrap>:1360: in _find_and_load
???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:935: in _load_unlocked
???
<frozen importlib._bootstrap_external>:1022: in exec_module
???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
"""Object-oriented filesystem paths.
This module provides classes to represent abstract paths and concrete
paths with operations that have semantics appropriate for different
operating systems.
"""
from ._abc import *
from ._local import *
> __all__ = (_abc.__all__ +
_local.__all__)
E NameError: name '_abc' is not defined. Did you forget to import '_abc'?
/usr/lib64/python3.13/pathlib/__init__.py:11: NameError
----------------------------- Captured stderr call -----------------------------
Check import: math
Check import: wave
Check import: csv
Check import: pathlib
This commit is contained in:
parent
a389cc4674
commit
d430201e60
1 changed files with 3 additions and 3 deletions
|
|
@ -160,15 +160,15 @@ def test_modules_from_files_are_found(tmp_path):
|
|||
test_file_3 = tmp_path / 'this_is_a_file_in_tmp_path_3.txt'
|
||||
|
||||
test_file_1.write_text('math\nwave\n')
|
||||
test_file_2.write_text('csv\npathlib\n')
|
||||
test_file_2.write_text('csv\nnetrc\n')
|
||||
test_file_3.write_text('logging\ncsv\n')
|
||||
|
||||
# Make sure the tested modules are not already in sys.modules
|
||||
for m in ('math', 'wave', 'csv', 'pathlib', 'logging'):
|
||||
for m in ('math', 'wave', 'csv', 'netrc', 'logging'):
|
||||
sys.modules.pop(m, None)
|
||||
|
||||
modules_main(['-f', str(test_file_1), '-f', str(test_file_2), '-f', str(test_file_3), ])
|
||||
for module in ('csv', 'math', 'wave', 'pathlib', 'logging'):
|
||||
for module in ('csv', 'math', 'wave', 'netrc', 'logging'):
|
||||
assert module in sys.modules
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue