Python-future: 导入`backports` 和`moves` 包,从用户文件夹导入(例如`test.py`),

创建于 2017-01-28  ·  4评论  ·  资料来源: PythonCharmers/python-future

未来版本:0.16.0
蟒蛇版:3.5

当导入future.movesfuture.backports包时,它会调用import_top_level_modules()来尝试按名称导入各种模块。 例如,如果用户项目中有test.py ,它也会被意外导入。

根据一个牵连提交 264f9bcdf0 的消息,引入了import_top_level_modules()方法是为了“让测试运行程序在 Py3 上运行 travis-ci”
将此代码放在测试包中不是更好吗?

0.19 bug

最有用的评论

在将 apache_beam 与 python3 一起使用时,我只是被这个咬了。

重现:

echo "raise NotImplementedError('This test.py file should not be touched')" >> ./test.py
pip install apache_beam
python -c "import apache_beam as beam"

我注意到从import_top_level_modules调用的exclude_local_folder_imports的注释指出:

(This was need prior to v0.16.0 because the presence of a configparser
    folder would otherwise have prevented setuptools from running on Py3. Maybe
    it's not needed any more?)

没有它似乎工作正常。 也许是时候了。

所有4条评论

这事有进一步更新吗?

在将 apache_beam 与 python3 一起使用时,我只是被这个咬了。

重现:

echo "raise NotImplementedError('This test.py file should not be touched')" >> ./test.py
pip install apache_beam
python -c "import apache_beam as beam"

我注意到从import_top_level_modules调用的exclude_local_folder_imports的注释指出:

(This was need prior to v0.16.0 because the presence of a configparser
    folder would otherwise have prevented setuptools from running on Py3. Maybe
    it's not needed any more?)

没有它似乎工作正常。 也许是时候了。

在使用依赖于这个包的破折号绘图库时也被咬了。 我得到了非常奇怪的行为,因为我碰巧有一个快速而肮脏的test.py用于在开发过程中试验我的包,结果证明每次我进行本地测试时它一直在运行并默默地改变临界状态我的应用程序。 我真的不喜欢调试这样的无声问题。 请考虑优先删除此行为。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

treyhunner picture treyhunner  ·  5评论

foreignmeloman picture foreignmeloman  ·  3评论

wagnerpeer picture wagnerpeer  ·  12评论

asottile picture asottile  ·  18评论

jackjansen picture jackjansen  ·  7评论