Python mock.patch.stopall() Examples

The following are 30 code examples of mock.patch.stopall(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module mock.patch , or try the search function .
Example #1
Source File: test_node.py    From aerospike-admin with Apache License 2.0 6 votes vote down vote up
def setUp(self):
        info_cinfo = patch('lib.client.node.Node._info_cinfo')
        getfqdn = patch('lib.client.node.getfqdn')
        getaddrinfo = patch('socket.getaddrinfo')

        self.addCleanup(patch.stopall)

        lib.client.node.Node._info_cinfo = info_cinfo.start()
        lib.client.node.getfqdn = getfqdn.start()
        socket.getaddrinfo = getaddrinfo.start()

        Node._info_cinfo.return_value = ""
        lib.client.node.getfqdn.return_value = "host.domain.local"
        socket.getaddrinfo.return_value = [(2, 1, 6, '', ('192.1.1.1', 3000))]

    #@unittest.skip("Known Failure") 
Example #2
Source File: test_cluster.py    From aerospike-admin with Apache License 2.0 6 votes vote down vote up
def setUp(self):
        info_cinfo = patch('lib.client.node.Node._info_cinfo')
        getfqdn = patch('lib.client.node.getfqdn')
        getaddrinfo = patch('socket.getaddrinfo')

        self.addCleanup(patch.stopall)

        lib.client.node.Node._info_cinfo = info_cinfo.start()
        lib.client.node.getfqdn = getfqdn.start()
        socket.getaddrinfo = getaddrinfo.start()

        Node._info_cinfo.return_value = ""
        lib.client.node.getfqdn.return_value = "host.domain.local"
        def getaddressinfo_side_effect(*args):
            return [(2, 1, 6, '', (args[0], 3000))]

        socket.getaddrinfo = Mock(side_effect=getaddressinfo_side_effect)
        # socket.getaddrinfo.return_value = [(2, 1, 6, '', ("192.1.1.1", 3000))] 
Example #3
Source File: test_facade.py    From GloboNetworkAPI with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #4
Source File: test_dkim.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #5
Source File: test_dkim.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #6
Source File: test_image_info.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #7
Source File: test_spf.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #8
Source File: test_spf.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #9
Source File: test_spam_cop.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #10
Source File: test_spam_cop.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #11
Source File: test_spf.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #12
Source File: test_context.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #13
Source File: test_context.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #14
Source File: test_regex.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #15
Source File: test_zbar_library.py    From pyzbar with MIT License 5 votes vote down vote up
def setUp(self):
        self.addCleanup(patch.stopall)
        self.sys = patch('pyzbar.zbar_library.sys', autospec=True).start() 
Example #16
Source File: test_zbar_library.py    From pyzbar with MIT License 5 votes vote down vote up
def setUp(self):
        self.addCleanup(patch.stopall)
        self.cdll = patch(
            'pyzbar.zbar_library.cdll', autospec=True
        ).start()
        self.find_library = patch(
            'pyzbar.zbar_library.find_library', autospec=True
        ).start()
        self.platform = patch(
            'pyzbar.zbar_library.platform', autospec=True
        ).start()
        self.windows_fnames = patch(
            'pyzbar.zbar_library._windows_fnames', autospec=True,
            return_value=('dll fname', ['dependency fname'])
        ).start() 
Example #17
Source File: test_save_pool.py    From GloboNetworkAPI with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #18
Source File: test_context.py    From OrangeAssassin with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall() 
Example #19
Source File: test_add_ipv4_network_resource.py    From GloboNetworkAPI with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #20
Source File: test_allocate_network.py    From GloboNetworkAPI with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #21
Source File: test_facade.py    From GloboNetworkAPI with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #22
Source File: test_create_network.py    From GloboNetworkAPI with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #23
Source File: test_create_vip.py    From GloboNetworkAPI with Apache License 2.0 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #24
Source File: test_pipeline_runs_artifacts.py    From azure-devops-cli-extension with MIT License 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #25
Source File: test_pipeline_folders.py    From azure-devops-cli-extension with MIT License 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #26
Source File: test_pipelines_build.py    From azure-devops-cli-extension with MIT License 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #27
Source File: test_univeral.py    From azure-devops-cli-extension with MIT License 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #28
Source File: test_pull_request.py    From azure-devops-cli-extension with MIT License 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #29
Source File: test_policy.py    From azure-devops-cli-extension with MIT License 5 votes vote down vote up
def tearDown(self):
        patch.stopall() 
Example #30
Source File: test_repository.py    From azure-devops-cli-extension with MIT License 5 votes vote down vote up
def tearDown(self):
        patch.stopall()