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.

classification
Title: test_importlib fails on Mac OSX 10.5.6 w/ case-sensitive file system
Type: behavior Stage: resolved
Components: Library (Lib), Tests Versions: Python 3.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: benjamin.peterson, brett.cannon, donmez
Priority: release blocker Keywords: patch

Created on 2009-03-08 12:59 by donmez, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
case_sensitivity_tests.diff brett.cannon, 2009-05-08 00:00 Take 2 on fixing case-sensitivity detection
skip_bytecode_writing.diff brett.cannon, 2009-05-09 23:01 Tighten up skipping tests requiring sys.dont_write_bycode to be False
test_file_loader.diff brett.cannon, 2009-05-10 19:39 Fix test_file_loader for loss of writes_bytecode
Messages (22)
msg83308 - (view) Author: Ismail Donmez (donmez) * Date: 2009-03-08 12:59
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

----------------------------------------------------------------------
msg83329 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-03-08 20:54
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.
msg83330 - (view) Author: Ismail Donmez (donmez) * Date: 2009-03-08 21:28
Yes its case sensitive.
msg83331 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-03-08 21:30
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.
msg85164 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-04-02 05:18
Fixed in r71042.
msg85340 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-04-03 22:26
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?
msg85373 - (view) Author: Ismail Donmez (donmez) * Date: 2009-04-04 06:18
Sure thing, I am waiting for alpha2.

Regards.
msg85473 - (view) Author: Ismail Donmez (donmez) * Date: 2009-04-05 10:24
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
msg85554 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-04-05 18:48
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?
msg85558 - (view) Author: Ismail Donmez (donmez) * Date: 2009-04-05 19:13
[~]> python3.1 tester.py
original name: .CFUserTextEncoding
changed name: .CFUSERTEXTENCODING
case-sensitive

I'll do a rebuild just in case. Thanks.
msg87366 - (view) Author: Ismail Donmez (donmez) * Date: 2009-05-07 11:32
Fails in beta1.
msg87390 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-05-07 18:56
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.
msg87391 - (view) Author: Ismail Donmez (donmez) * Date: 2009-05-07 19:05
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)
msg87401 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-05-07 20:02
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.
msg87414 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-05-08 00:00
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.
msg87425 - (view) Author: Ismail Donmez (donmez) * Date: 2009-05-08 05:06
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 {}
msg87450 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-05-08 16:58
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.
msg87515 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-05-09 23:01
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.
msg87516 - (view) Author: Ismail Donmez (donmez) * Date: 2009-05-10 06:59
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
msg87538 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-05-10 19:39
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.
msg87548 - (view) Author: Ismail Donmez (donmez) * Date: 2009-05-10 21:02
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
msg87559 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-05-11 01:47
OK, that means everything is fixed as case_sensitivity_tests.diff fixes
those test errors.

Committed in r72559.
History
Date User Action Args
2022-04-11 14:56:46adminsetnosy: + benjamin.peterson
github: 49692
2009-05-11 01:47:24brett.cannonsetstatus: open -> closed
resolution: fixed
messages: + msg87559

stage: patch review -> resolved
2009-05-10 21:02:17donmezsetstatus: pending -> open

messages: + msg87548
2009-05-10 19:39:52brett.cannonsetstatus: open -> pending
2009-05-10 19:39:31brett.cannonsetfiles: + test_file_loader.diff

messages: + msg87538
2009-05-10 06:59:40donmezsetstatus: pending -> open

messages: + msg87516
2009-05-09 23:02:00brett.cannonsetstatus: open -> pending
files: + skip_bytecode_writing.diff
messages: + msg87515
2009-05-08 16:58:57brett.cannonsetmessages: + msg87450
2009-05-08 05:07:11donmezsetstatus: pending -> open

messages: + msg87425
2009-05-08 00:00:14brett.cannonsetstatus: open -> pending
files: + case_sensitivity_tests.diff
messages: + msg87414
2009-05-07 23:58:15brett.cannonsetfiles: - case_sensitivity_tests.diff
2009-05-07 20:02:40brett.cannonsetresolution: fixed -> (no value)
messages: + msg87401
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
2009-05-07 19:05:18donmezsetstatus: pending -> open

messages: + msg87391
2009-05-07 18:56:44brett.cannonsetstatus: open -> pending
files: + case_sensitivity_tests.diff
messages: + msg87390

keywords: + patch
priority: low -> release blocker
stage: patch review
2009-05-07 18:51:28brett.cannonsetfiles: - tester.py
2009-05-07 11:32:03donmezsetmessages: + msg87366
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
2009-04-05 19:13:38donmezsetmessages: + msg85558
2009-04-05 18:48:15brett.cannonsetfiles: + tester.py

messages: + msg85554
2009-04-05 10:24:36donmezsetmessages: + msg85473
title: [3.1alpha1] test_importlib fails on Mac OSX 10.5.6 -> [3.1alpha1,2] test_importlib fails on Mac OSX 10.5.6
2009-04-04 06:18:58donmezsetstatus: pending -> open

messages: + msg85373
2009-04-03 22:26:28brett.cannonsetstatus: closed -> pending

messages: + msg85340
2009-04-02 05:18:10brett.cannonsetstatus: open -> closed
resolution: fixed
messages: + msg85164
2009-03-08 21:30:45brett.cannonsetpriority: normal -> low

messages: + msg83331
2009-03-08 21:28:09donmezsetmessages: + msg83330
2009-03-08 20:54:11brett.cannonsetassignee: brett.cannon
messages: + msg83329
2009-03-08 13:05:30pitrousetpriority: normal
components: + Library (Lib), Tests
2009-03-08 13:05:15pitrousetnosy: + brett.cannon
2009-03-08 12:59:18donmezcreate