Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_zoneinfo fails if the _lzma module is missing #85648

Closed
vstinner opened this issue Aug 4, 2020 · 3 comments
Closed

test_zoneinfo fails if the _lzma module is missing #85648

vstinner opened this issue Aug 4, 2020 · 3 comments
Labels
3.10 only security fixes tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

vstinner commented Aug 4, 2020

BPO 41476
Nosy @vstinner, @pganssle, @tirkarthi
Superseder
  • bpo-41371: test_zoneinfo fails when lzma module is unavailable
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-08-07.15:32:32.518>
    created_at = <Date 2020-08-04.15:04:07.220>
    labels = ['tests', '3.10']
    title = 'test_zoneinfo fails if the _lzma module is missing'
    updated_at = <Date 2020-08-07.15:32:32.517>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-08-07.15:32:32.517>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-08-07.15:32:32.518>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2020-08-04.15:04:07.220>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 41476
    keywords = []
    message_count = 3.0
    messages = ['374819', '374821', '374826']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'p-ganssle', 'xtreak']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '41371'
    type = None
    url = 'https://bugs.python.org/issue41476'
    versions = ['Python 3.10']

    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 4, 2020

    Error when _lzma extension is missing:

    test test_zoneinfo crashed -- Traceback (most recent call last):                                                                                                                             
      File "/home/vstinner/python/master/Lib/test/libregrtest/runtest.py", line 272, in _runtest_inner
        refleak = _runtest_inner2(ns, test_name)                                                  
      File "/home/vstinner/python/master/Lib/test/libregrtest/runtest.py", line 223, in _runtest_inner2                                                                                          
        the_module = importlib.import_module(abstest)                                                                                                                                            
      File "/home/vstinner/python/master/Lib/importlib/__init__.py", 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/__init__.py", line 1, in <module>                                                                                                
        from .test_zoneinfo import *                                                                                                                                                             
      File "/home/vstinner/python/master/Lib/test/test_zoneinfo/test_zoneinfo.py", line 9, in <module>                                
        import lzma                                                                                                                                                                              
      File "/home/vstinner/python/master/Lib/lzma.py", 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')".

    @vstinner vstinner added 3.10 only security fixes tests Tests in the Lib/test dir labels Aug 4, 2020
    @vstinner
    Copy link
    Member Author

    vstinner commented Aug 4, 2020

    See also bpo-41477: test_genericalias fails if ctypes is missing.

    @tirkarthi
    Copy link
    Member

    Duplicate of https://bugs.python.org/issue41371

    @vstinner vstinner closed this as completed Aug 7, 2020
    @vstinner vstinner closed this as completed Aug 7, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants