Why doesn't accessing unittest.mock.patch throw an attribute error when I import testfixtures in the below code?
I myself suspect that it is because testfixtures might be importing unittest.mock somewhere internally however, is there any way I could change this behavior if I want unittest.mock to always be imported explicitly and get an AttributeError otherwise?
import unittest
import sys
import os
import testfixtures
class Test(unittest.TestCase):
@unittest.mock.patch('sys.version_info', (2,7,0))
def test_version(self):
assert(sys.version_info < (3,0,0))
Accessing unitest.mock without importing it should throw an AttributeError but that's not the case when testfixtures is imported.
Aucun commentaire:
Enregistrer un commentaire