pytest: ensure we follow PEP-235 on case-insensitive filesystems

Running PyTest with files including ZODB gives an odd problem: ZODB can be imported, but its component FileSystem cannot.

import ZODB   # That works fine.
import ZODB.FileStorage
ImportError: No module named FileStorage

On the other hand, running the same code from the Python interpreter runs fine.

This is version PyTest version 3.2.2, Python 2.7.13, and ZODB 5.2.4 There exists ZODB-5.2.4-py2.7.egg/ZODB/FileStorage/init.py, a ZODB.pth pointing to the egg, and no other modules have issues; just any submodule of ZODB. No odd permission errors. After an hour of experiments and exercising Google-Fu, I got nothing.

Any workaround would be appreciated.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (8 by maintainers)

Commits related to this issue

Most upvoted comments

To be more clear, when doing an import ZODB from cbmx/data/zodb.py:

  • Pytest is picking up cbmx/data/zodb.py.
  • Python is picking up ‘/opt/CBMX/lib/python2.7/site-packages/ZODB-5.2.4-py2.7.egg/ZODB/init.pyc’

These assertions pass under pytest, but not under python:

mods to site-packages/cbmx/data/zodb.py

before = sys.modules.copy()
import ZODB                                             # flake8: noqa
after = sys.modules.copy()
difference = sorted([name for name in set(after.keys()).difference(set(before.keys()))])
assert len(difference) == 0
assert 'cbmx/data' in ZODB.__file__
assert ZODB.__file__ == __file__

We made one or two ‘toy’ file structures but cannot make pytest fail on the toys, yet.