You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2020-12-02.11:14:10.667>labels= ['3.7', 'type-bug', 'library']
title='unittest.patch confuses modules with base modules'updated_at=<Date2021-07-17.14:15:49.350>user='https://github.com/twolodzko'
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:
withpath('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.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: