Python3: patch_mock_module not patching unittest.mock
Bug #1882107 reported by
Gorka Eguileor
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslotest |
New
|
Undecided
|
Unassigned |
Bug Description
When running in Python 3, method "patch_mock_module" in "mock_fixture" does not patch "unittest.mock" and only patches the "mock" module, so we end up having the "autospec" issues described in https:/
To post a comment you must log in.
I think this is addressed by https:/ /review. opendev. org/#/c/ 717311/
oslotest was switched over to unittest.mock in ussuri, but there were unintended side effects from that since we found many projects were using the third party mock module, but not declaring it in their own test-requirements. They were depending on it being present by being pulled in by the oslotest install.
Since it was late in the cycle, the switch in oslotest from mock to unittest.mock was reverted. Now that we are into victoria, this should be done again and any projects that break should be updated to either explicitly declare their dependency on mock, or ideally, update their mocking usage to use the unittest.mock module.