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 xtreak
Recipients cjw296, mariocj89, michael.foord, nedbat, pablogsal, xtreak
Date 2019-04-11.17:05:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1555002316.04.0.985076485757.issue36593@roundup.psfhosted.org>
In-reply-to
Content
Copying my comment from GitHub : 

This issue occurs only when the mock module import and code are executed under tracing. In order to test this I have tried patching sys.modules to remove unittest.mock in order to trigger an import under tracing. Though unittest.mock is deleted reference to unittest.mock.patch is held by two tests (test_patch_dict_test_prefix and test_patch_test_prefix) that change the TEST_PREFIX. Hence somehow there is a difference in the unittest.mock.patch object referred under these tests and inside mock module causing reference to unchanged TEST_PREFIX and hence test case failures. So I have kept a reference to old patch object and restored it in the end of this test to make sure everything is in sync.

There is some difficulty in testing this since the import needs to be executed under tracing and manipulating sys.modules to delete unittest.mock and reimport causes some old references in other tests to go out of sync. A clean way to do this would be to have this test as a separate file and hence not impacting other tests but I am not sure if it's worth enough to justify a separate file to test this. Maybe I am missing something here on a better way to test this. Any guidance would be helpful.

Thanks
History
Date User Action Args
2019-04-11 17:05:16xtreaksetrecipients: + xtreak, nedbat, cjw296, michael.foord, mariocj89, pablogsal
2019-04-11 17:05:16xtreaksetmessageid: <1555002316.04.0.985076485757.issue36593@roundup.psfhosted.org>
2019-04-11 17:05:16xtreaklinkissue36593 messages
2019-04-11 17:05:15xtreakcreate