This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: test_zoneinfo fails if the _lzma module is missing
Type: Stage: resolved
Components: Tests Versions: Python 3.10
Status: closed Resolution: duplicate
Dependencies: Superseder: test_zoneinfo fails when lzma module is unavailable
View: 41371
Assigned To: Nosy List: p-ganssle, vstinner, xtreak
Priority: normal Keywords:

Created on 2020-08-04 15:04 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg374819 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-08-04 15:04
Error when _lzma extension is missing:

test test_zoneinfo crashed -- Traceback (most recent call last):                                                                                                                             
  File "/home/vstinner/python/master/Lib/test/libregrtest/", line 272, in _runtest_inner
    refleak = _runtest_inner2(ns, test_name)                                                  
  File "/home/vstinner/python/master/Lib/test/libregrtest/", line 223, in _runtest_inner2                                                                                          
    the_module = importlib.import_module(abstest)                                                                                                                                            
  File "/home/vstinner/python/master/Lib/importlib/", line 126, in import_module                                                                                                  
    return _bootstrap._gcd_import(name[level:], package, level)                                                                                                                              
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import                                                                                                                            
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked                                                                                                                 
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked                                                                                                                          
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module                                                                                                                    
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed              
  File "/home/vstinner/python/master/Lib/test/test_zoneinfo/", line 1, in <module>                                                                                                
    from .test_zoneinfo import *                                                                                                                                                             
  File "/home/vstinner/python/master/Lib/test/test_zoneinfo/", line 9, in <module>                                
    import lzma                                                                                                                                                                              
  File "/home/vstinner/python/master/Lib/", line 27, in <module>                                                                                                                      
    from _lzma import *                                                                                                                                                                      
ModuleNotFoundError: No module named '_lzma'

The minimum fix is to skip test_zoneinfo is lzma is missing. For example, replace "import lzma" with "lzma = support.import_helper.import_module('lzma')".
msg374821 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-08-04 15:06
See also bpo-41477: test_genericalias fails if ctypes is missing.
msg374826 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2020-08-04 15:16
Duplicate of
Date User Action Args
2022-04-11 14:59:34adminsetgithub: 85648
2020-08-07 15:32:32vstinnersetstatus: open -> closed
superseder: test_zoneinfo fails when lzma module is unavailable
resolution: duplicate
stage: resolved
2020-08-04 15:16:06xtreaksetnosy: + xtreak
messages: + msg374826
2020-08-04 15:06:06vstinnersetmessages: + msg374821
2020-08-04 15:04:07vstinnercreate