cibuildwheel icon indicating copy to clipboard operation
cibuildwheel copied to clipboard

Name colistion in test

Open Czaki opened this issue 5 years ago • 4 comments

In one of project I meet error where import lib cannot import one of c-extensions. After move package to src this problem disappear.

it looks like name collision initial layout

root
├── setup.py
└── package_name

changed

root
├── setup.py
└──src
    └──package_name

So when in test there is imporlib.import_module("package_name.sub_package") it may search in source instead of installed package (because there is same named directory is in current dir).

For full build isolation there should be changed directory before execute test. But such change may break someone build system.

@YannickJadoul @joerick What dou you think about this. Change this? Mention in documentation?

Czaki avatar Jun 06 '20 18:06 Czaki

Huh, I thought we already did this? The tests command is executed with $HOME as pwd:

https://github.com/joerick/cibuildwheel/blob/31c9247921a1585b3b6dc78eb150327ff9c883dc/cibuildwheel/linux.py#L230-L232

https://github.com/joerick/cibuildwheel/blob/31c9247921a1585b3b6dc78eb150327ff9c883dc/cibuildwheel/macos.py#L251

https://github.com/joerick/cibuildwheel/blob/31c9247921a1585b3b6dc78eb150327ff9c883dc/cibuildwheel/windows.py#L243

Are you sure that that is what's going wrong? Or is there a different problem?

But I agree it should probably be fixed, if we can figure out what goes wrong.

YannickJadoul avatar Jun 07 '20 23:06 YannickJadoul

Ok. I see this in code, but build fail. If I found what happens. Unfortunately selected python use froze libs

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1006: in _gcd_import
    ???
<frozen importlib._bootstrap>:983: in _find_and_load
    ???

but I already try to debug this. without success.

Czaki avatar Jun 08 '20 05:06 Czaki

Did you try to import package_name and print package_name.__file__?

YannickJadoul avatar Jun 08 '20 08:06 YannickJadoul

Is this still a problem, or can it be closed?

henryiii avatar Feb 01 '21 04:02 henryiii