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.

Author twolodzko
Recipients twolodzko
Date 2020-12-02.11:14:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606907650.68.0.627501426895.issue42535@roundup.psfhosted.org>
In-reply-to
Content
Nonetheless having several attempts, I wasn't able to create reproducible example for this bug, but I will try describing it in detail.

I have a package with multiple modules. One of the paths is like `mymodule.nestedmodule.io`, among other functions, this module contains functions `foo()` and `bar()`, where `bar()` does call `foo()`. The module *does not* import base python's `io` module. I have a unit test that patches:

with path('mymodule.nestedmodule.io.foo'):
    bar()


The problem is, when running the test I get the following error: `AttributeError: <module 'io' from '/usr/local/lib/python3.7/io.py'> does not have the attribute 'foo'`. The problem is solved when I rename `io` to `myio` and correct all the paths to use the new name.
History
Date User Action Args
2020-12-02 11:14:10twolodzkosetrecipients: + twolodzko
2020-12-02 11:14:10twolodzkosetmessageid: <1606907650.68.0.627501426895.issue42535@roundup.psfhosted.org>
2020-12-02 11:14:10twolodzkolinkissue42535 messages
2020-12-02 11:14:10twolodzkocreate