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_importlib fails on Mac OSX 10.5.6 w/ case-sensitive file system #49692

Closed
donmez mannequin opened this issue Mar 8, 2009 · 22 comments
Closed

test_importlib fails on Mac OSX 10.5.6 w/ case-sensitive file system #49692

donmez mannequin opened this issue Mar 8, 2009 · 22 comments
Assignees
Labels
release-blocker stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@donmez
Copy link
Mannequin

donmez mannequin commented Mar 8, 2009

BPO 5442
Nosy @brettcannon
Files
  • case_sensitivity_tests.diff: Take 2 on fixing case-sensitivity detection
  • skip_bytecode_writing.diff: Tighten up skipping tests requiring sys.dont_write_bycode to be False
  • test_file_loader.diff: Fix test_file_loader for loss of writes_bytecode
  • 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 = 'https://github.com/brettcannon'
    closed_at = <Date 2009-05-11.01:47:24.104>
    created_at = <Date 2009-03-08.12:59:17.914>
    labels = ['tests', 'type-bug', 'library', 'release-blocker']
    title = 'test_importlib fails on Mac OSX 10.5.6 w/ case-sensitive file system'
    updated_at = <Date 2009-05-11.01:47:24.092>
    user = 'https://bugs.python.org/donmez'

    bugs.python.org fields:

    activity = <Date 2009-05-11.01:47:24.092>
    actor = 'brett.cannon'
    assignee = 'brett.cannon'
    closed = True
    closed_date = <Date 2009-05-11.01:47:24.104>
    closer = 'brett.cannon'
    components = ['Library (Lib)', 'Tests']
    creation = <Date 2009-03-08.12:59:17.914>
    creator = 'donmez'
    dependencies = []
    files = ['13916', '13946', '13950']
    hgrepos = []
    issue_num = 5442
    keywords = ['patch']
    message_count = 22.0
    messages = ['83308', '83329', '83330', '83331', '85164', '85340', '85373', '85473', '85554', '85558', '87366', '87390', '87391', '87401', '87414', '87425', '87450', '87515', '87516', '87538', '87548', '87559']
    nosy_count = 2.0
    nosy_names = ['brett.cannon', 'donmez']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue5442'
    versions = ['Python 3.1']

    @donmez
    Copy link
    Mannequin Author

    donmez mannequin commented Mar 8, 2009

    Two failures in test_importlib:

    ======================================================================
    FAIL: test_case_insensitivity
    (importlib.test.extension.test_case_sensitivity.ExtensionModuleCaseSensi
    tivityTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a1/Lib/importlib/test/extension/test_case_sensitivity.py", line 29, 
    in test_case_insensitivity
        self.assert_(hasattr(loader, 'load_module'))
    AssertionError: None

    ======================================================================
    FAIL: test_insensitive
    (importlib.test.source.test_case_sensitivity.CaseSensitivityTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a1/Lib/importlib/test/source/test_case_sensitivity.py", line 49, in 
    test_insensitive
        self.assert_(hasattr(insensitive, 'load_module'))
    AssertionError: None

    @donmez donmez mannequin added the type-bug An unexpected behavior, bug, or error label Mar 8, 2009
    @pitrou pitrou added stdlib Python modules in the Lib dir tests Tests in the Lib/test dir labels Mar 8, 2009
    @brettcannon
    Copy link
    Member

    Is your version of OS X installed on a case-sensitive filesystem? These
    tests all pass for me on my Macbook on 10.5.6.

    @brettcannon brettcannon self-assigned this Mar 8, 2009
    @donmez
    Copy link
    Mannequin Author

    donmez mannequin commented Mar 8, 2009

    Yes its case sensitive.

    @brettcannon
    Copy link
    Member

    Ah, OK, that explains it then. I guess I need to come up with a test to
    verify whether commonly case-sensitive filesystems are truly
    case-sensitive before running the tests.

    Thanks for the quick response, Ismail.

    @brettcannon
    Copy link
    Member

    Fixed in r71042.

    @brettcannon
    Copy link
    Member

    If you could, Ismail, can you verify this either from svn or when the
    next release of 3.1 comes out and update this issue?

    @brettcannon brettcannon reopened this Apr 3, 2009
    @donmez
    Copy link
    Mannequin Author

    donmez mannequin commented Apr 4, 2009

    Sure thing, I am waiting for alpha2.

    Regards.

    @donmez
    Copy link
    Mannequin Author

    donmez mannequin commented Apr 5, 2009

    Still fails with 3.1 alpha2:

    ======================================================================
    ERROR: test_is_package
    (importlib.test.frozen.test_loader.InspectLoaderTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/frozen/test_loader.py", line 80, in 
    test_is_package
        result = machinery.FrozenImporter.is_package(name)
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/_bootstrap.py", line 191, in wrapper
        return fxn(self, fullname)
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/_bootstrap.py", line 301, in is_package
        return imp.is_frozen_package(fullname)
    AttributeError: 'module' object has no attribute 'is_frozen_package'

    ======================================================================
    ERROR: test_lacking_parent
    (importlib.test.source.test_abc_loader.PyLoaderTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 162, in 
    test_lacking_parent
        __loader__=mock)
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 128, in 
    eq_attrs
        "{} attribute: {} != {}".format(attr, found, val))
    ValueError: zero length field name in format

    ======================================================================
    ERROR: test_module (importlib.test.source.test_abc_loader.PyLoaderTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 138, in 
    test_module
        __loader__=mock)
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 128, in 
    eq_attrs
        "{} attribute: {} != {}".format(attr, found, val))
    ValueError: zero length field name in format

    ======================================================================
    ERROR: test_package
    (importlib.test.source.test_abc_loader.PyLoaderTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 151, in 
    test_package
        __loader__=mock)
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 128, in 
    eq_attrs
        "{} attribute: {} != {}".format(attr, found, val))
    ValueError: zero length field name in format

    ======================================================================
    ERROR: test_lacking_parent
    (importlib.test.source.test_abc_loader.PyPycLoaderTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 270, in 
    test_lacking_parent
        mock, name = super().test_lacking_parent()
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 162, in 
    test_lacking_parent
        __loader__=mock)
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 128, in 
    eq_attrs
        "{} attribute: {} != {}".format(attr, found, val))
    ValueError: zero length field name in format

    ======================================================================
    ERROR: test_module
    (importlib.test.source.test_abc_loader.PyPycLoaderTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 262, in 
    test_module
        mock, name = super().test_module()
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 138, in 
    test_module
        __loader__=mock)
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 128, in 
    eq_attrs
        "{} attribute: {} != {}".format(attr, found, val))
    ValueError: zero length field name in format

    ======================================================================
    ERROR: test_package
    (importlib.test.source.test_abc_loader.PyPycLoaderTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 266, in 
    test_package
        mock, name = super().test_package()
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 151, in 
    test_package
        __loader__=mock)
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 128, in 
    eq_attrs
        "{} attribute: {} != {}".format(attr, found, val))
    ValueError: zero length field name in format

    ======================================================================
    FAIL: test_case_insensitivity
    (importlib.test.extension.test_case_sensitivity.ExtensionModuleCaseSensi
    tivityTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/extension/test_case_sensitivity.py", line 29, 
    in test_case_insensitivity
        self.assert_(hasattr(loader, 'load_module'))
    AssertionError: False is not True

    ======================================================================
    FAIL: test_module_reuse
    (importlib.test.source.test_abc_loader.PyPycLoaderTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 275, in 
    test_module_reuse
        self.verify_bytecode(mock, name)
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/util.py", line 18, in wrapper
        to_return = fxn(*args, **kwargs)
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_abc_loader.py", line 253, in 
    verify_bytecode
        self.assert_(name in mock.module_bytecode)
    AssertionError: False is not True

    ======================================================================
    FAIL: test_insensitive
    (importlib.test.source.test_case_sensitivity.CaseSensitivityTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Downloads/Python-
    3.1a2/Lib/importlib/test/source/test_case_sensitivity.py", line 49, in 
    test_insensitive
        self.assert_(hasattr(insensitive, 'load_module'))
    AssertionError: False is not True

    @donmez donmez mannequin changed the title [3.1alpha1] test_importlib fails on Mac OSX 10.5.6 [3.1alpha1,2] test_importlib fails on Mac OSX 10.5.6 Apr 5, 2009
    @brettcannon
    Copy link
    Member

    Something is wrong with your build, Ismail, because most of those
    failures are because of things that were added between alpha1 and alpha2.

    But to speed this up, can you tell me what the file I attached to the
    issue prints out?

    @donmez
    Copy link
    Mannequin Author

    donmez mannequin commented Apr 5, 2009

    [~]> python3.1 tester.py
    original name: .CFUserTextEncoding
    changed name: .CFUSERTEXTENCODING
    case-sensitive

    I'll do a rebuild just in case. Thanks.

    @donmez
    Copy link
    Mannequin Author

    donmez mannequin commented May 7, 2009

    Fails in beta1.

    @donmez donmez mannequin changed the title [3.1alpha1,2] test_importlib fails on Mac OSX 10.5.6 [3.1alpha1,2,beta1] test_importlib fails on Mac OSX 10.5.6 May 7, 2009
    @brettcannon
    Copy link
    Member

    Bloody OS X and its default case-insensitivity.

    Ismail, please try the attached patch to double-check this solves the
    issue ASAP so this doesn't hold up Python 3.1 rc1.

    @donmez
    Copy link
    Mannequin Author

    donmez mannequin commented May 7, 2009

    Tested with: ./python -m test.regrtest -v test_importlib

    3 failures:

    ======================================================================
    FAIL: test_case_insensitivity
    (importlib.test.extension.test_case_sensitivity.ExtensionModuleCaseSensi
    tivityTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Python-
    3.1b1/Lib/importlib/test/extension/test_case_sensitivity.py", line 29, 
    in test_case_insensitivity
        self.assert_(hasattr(loader, 'load_module'))
    AssertionError: False is not True

    ======================================================================
    FAIL: test_lacking_parent
    (importlib.test.source.test_abc_loader.PyPycLoaderTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Python-
    3.1b1/Lib/importlib/test/source/test_abc_loader.py", line 271, in 
    test_lacking_parent
        self.verify_bytecode(mock, name)
      File "/Users/cartman/Python-3.1b1/Lib/importlib/test/source/util.py", 
    line 18, in wrapper
        to_return = fxn(*args, **kwargs)
      File "/Users/cartman/Python-
    3.1b1/Lib/importlib/test/source/test_abc_loader.py", line 253, in 
    verify_bytecode
        self.assert_(name in mock.module_bytecode)
    AssertionError: False is not True

    ======================================================================
    FAIL: test_insensitive
    (importlib.test.source.test_case_sensitivity.CaseSensitivityTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Python-
    3.1b1/Lib/importlib/test/source/test_case_sensitivity.py", line 49, in 
    test_insensitive
        self.assert_(hasattr(insensitive, 'load_module'))
    AssertionError: False is not True

    Ran 166 tests in 0.133s

    FAILED (failures=3)

    @brettcannon
    Copy link
    Member

    Damn, that patch should have caused those case-sensitivity tests to be
    skipped. I will dig into this later today and hopefully have another
    patch to test some time tonight.

    @brettcannon brettcannon changed the title [3.1alpha1,2,beta1] test_importlib fails on Mac OSX 10.5.6 test_importlib fails on Mac OSX 10.5.6 w/ case-sensitive file system May 7, 2009
    @brettcannon
    Copy link
    Member

    OK, Ismail, here is another patch. Revert the last one and try this.
    Looks like I was being stupid by forgetting to remove the 'darwin'
    platform check. But I also made the check simpler.

    @donmez
    Copy link
    Mannequin Author

    donmez mannequin commented May 8, 2009

    Down to 1 failure:

    FAILED (failures=1)
    test test_importlib failed -- Traceback (most recent call last):
      File "/Users/cartman/Python-
    3.1b1/Lib/importlib/test/source/test_abc_loader.py", line 271, in 
    test_lacking_parent
        self.verify_bytecode(mock, name)
      File "/Users/cartman/Python-3.1b1/Lib/importlib/test/source/util.py", 
    line 18, in wrapper
        to_return = fxn(*args, **kwargs)
      File "/Users/cartman/Python-
    3.1b1/Lib/importlib/test/source/test_abc_loader.py", line 253, in 
    verify_bytecode
        self.assertIn(name, mock.module_bytecode)
    AssertionError: 'pkg.mod' not found in {}

    @brettcannon
    Copy link
    Member

    Thanks for the quick reply, Ismail! I will look into the last failure
    this weekend, but off the top of my head I am not sure why that test
    would be failing since everything to do with that test should be a mock
    and thus not touching the file system.

    @brettcannon
    Copy link
    Member

    OK, here is an attempt to fix this. My guess is it has something to do
    with sys.dont_write_bytecode, otherwise I cannot understand why you fail
    and not someone else since no other case-sensitive systems have reported
    this failure.

    @donmez
    Copy link
    Mannequin Author

    donmez mannequin commented May 10, 2009

    1 Fail:

    test test_importlib crashed -- <class 'AttributeError'>: 'module' object 
    has no attribute 'writes_bytecode'
    Traceback (most recent call last):
      File "/Users/cartman/Python-3.1b1/Lib/test/regrtest.py", line 620, in 
    runtest_inner
        indirect_test()
      File "/Users/cartman/Python-3.1b1/Lib/test/test_importlib.py", line 6, 
    in test_main
        run_unittest(importlib.test.test_suite('importlib.test'))
      File "/Users/cartman/Python-3.1b1/Lib/importlib/test/__init__.py", 
    line 22, in test_suite
        package_tests = getattr(sys.modules[package_name], 'test_suite')()
      File "/Users/cartman/Python-
    3.1b1/Lib/importlib/test/source/__init__.py", line 8, in test_suite
        return importlib.test.test_suite('importlib.test.source', directory)
      File "/Users/cartman/Python-3.1b1/Lib/importlib/test/__init__.py", 
    line 16, in test_suite
        __import__(module_name, level=0)
      File "/Users/cartman/Python-
    3.1b1/Lib/importlib/test/source/test_file_loader.py", line 111, in 
    <module>
        class BadBytecodeTest(unittest.TestCase):
      File "/Users/cartman/Python-
    3.1b1/Lib/importlib/test/source/test_file_loader.py", line 130, in 
    BadBytecodeTest
        @source_util.writes_bytecode
    AttributeError: 'module' object has no attribute 'writes_bytecode'
    1 test failed:
        test_importlib

    @brettcannon
    Copy link
    Member

    Bah, I screwed up and left a file out of skip_bytecode_writing.diff. If
    you apply test_file_loader along with that patch that should fix the error.

    @donmez
    Copy link
    Mannequin Author

    donmez mannequin commented May 10, 2009

    Applied skip_bytecode.diff and test_file_loader.diff clean build
    results in:

    ======================================================================
    FAIL: test_case_insensitivity
    (importlib.test.extension.test_case_sensitivity.ExtensionModuleCaseSensi
    tivityTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Python-
    3.1b1/Lib/importlib/test/extension/test_case_sensitivity.py", line 29, 
    in test_case_insensitivity
        self.assert_(hasattr(loader, 'load_module'))
    AssertionError: False is not True

    ======================================================================
    FAIL: test_insensitive
    (importlib.test.source.test_case_sensitivity.CaseSensitivityTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/cartman/Python-
    3.1b1/Lib/importlib/test/source/test_case_sensitivity.py", line 49, in 
    test_insensitive
        self.assert_(hasattr(insensitive, 'load_module'))
    AssertionError: False is not True

    Ran 166 tests in 0.124s

    FAILED (failures=2)
    test test_importlib failed -- errors occurred; run in verbose mode for
    details

    @brettcannon
    Copy link
    Member

    OK, that means everything is fixed as case_sensitivity_tests.diff fixes
    those test errors.

    Committed in r72559.

    @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
    release-blocker stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants