python类stopall()的实例源码

test_controllers.py 文件源码 项目:bitstore 作者: datahq 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def setUp(self):

        # Cleanup
        self.addCleanup(patch.stopall)

        # Request patch
        self.request = patch.object(module, 'request').start()
        # Various patches
        self.services = patch.object(module, 'services').start()

        self.original_config = dict(module.config)
        module.config['STORAGE_BUCKET_NAME'] = self.bucket = 'buckbuck'
        module.config['STORAGE_ACCESS_KEY_ID'] = ''
        module.config['STORAGE_SECRET_ACCESS_KEY'] = ''
        module.config['ACCESS_KEY_EXPIRES_IN'] = ''
        module.config['STORAGE_PATH_PATTERN'] = '{owner}/{dataset}/{path}'
        self.s3 = boto3.client('s3')
test_copytool_monitor.py 文件源码 项目:intel-manager-for-lustre 作者: intel-hpdd 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def setUp(self):
        super(CopytoolTestCase, self).setUp()

        from chroma_agent.config_store import ConfigStore
        self.mock_config = ConfigStore(tempfile.mkdtemp())
        patch('chroma_agent.copytool_monitor.config', self.mock_config).start()

        self.ct_id = '42'
        self.ct_bin_path = '/usr/sbin/lhsmtool_foo'
        self.ct_filesystem = 'testfs'
        self.ct_mountpoint = '/mnt/testfs'
        self.ct_archive = 2
        self.ct_index = 0
        self.ct = Copytool(self.ct_id, self.ct_index, self.ct_bin_path,
                           self.ct_archive, self.ct_filesystem,
                           self.ct_mountpoint, "")

        self.addCleanup(patch.stopall)
test_pact.py 文件源码 项目:pact-python 作者: pact-foundation 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def setUp(self):
        super(PactSetupTestCase, self).setUp()
        self.addCleanup(patch.stopall)
        self.mock_requests = patch('requests.api.request').start()
        self.target = Pact(self.consumer, self.provider)
        (self.target
         .given('I am creating a new pact using the Pact class')
         .upon_receiving('a specific request to the server')
         .with_request('GET', '/path')
         .will_respond_with(200, body='success'))

        self.delete_call = call('delete', 'http://localhost:1234/interactions',
                                headers={'X-Pact-Mock-Service': 'true'})

        self.put_interactions_call = call(
            'put', 'http://localhost:1234/interactions',
            data=None,
            headers={'X-Pact-Mock-Service': 'true'},
            json={'interactions': [{
                'response': {'status': 200, 'body': 'success'},
                'request': {'path': '/path', 'method': 'GET'},
                'description': 'a specific request to the server',
                'provider_state': 'I am creating a new pact using the '
                                  'Pact class'}]})
test_pact.py 文件源码 项目:pact-python 作者: pact-foundation 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def setUp(self):
        super(PactVerifyTestCase, self).setUp()
        self.addCleanup(patch.stopall)
        self.mock_requests = patch('requests.api.request').start()
        self.target = Pact(self.consumer, self.provider)
        (self.target
         .given('I am creating a new pact using the Pact class')
         .upon_receiving('a specific request to the server')
         .with_request('GET', '/path')
         .will_respond_with(200, body='success'))
        self.get_verification_call = call(
            'get', 'http://localhost:1234/interactions/verification',
            allow_redirects=True,
            headers={'X-Pact-Mock-Service': 'true'},
            params=None)

        self.post_publish_pacts_call = call(
            'post', 'http://localhost:1234/pact',
            data=None,
            headers={'X-Pact-Mock-Service': 'true'},
            json={'pact_dir': os.getcwd(),
                  'consumer': {'name': 'TestConsumer'},
                  'provider': {'name': 'TestProvider'}})
test_server.py 文件源码 项目:spoon 作者: SpamExperts 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def tearDown(self):
        unittest.TestCase.tearDown(self)
        patch.stopall()
test_kind.py 文件源码 项目:globomap-driver-napi 作者: globocom 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def tearDown(self):
        patch.stopall()
test_driver.py 文件源码 项目:globomap-driver-napi 作者: globocom 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def tearDown(self):
        patch.stopall()
test_rabbitmq.py 文件源码 项目:globomap-driver-napi 作者: globocom 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def tearDown(self):
        patch.stopall()
model_creator_test.py 文件源码 项目:gcp-census 作者: ocadotechnology 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def tearDown(self):
        self.testbed.deactivate()
        patch.stopall()
bigquery_table_streamer_test.py 文件源码 项目:gcp-census 作者: ocadotechnology 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def tearDown(self):
        patch.stopall()
model_creator_handler_test.py 文件源码 项目:gcp-census 作者: ocadotechnology 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def tearDown(self):
        self.testbed.deactivate()
        patch.stopall()
bigquery_handler_test.py 文件源码 项目:gcp-census 作者: ocadotechnology 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def tearDown(self):
        self.testbed.deactivate()
        patch.stopall()
test_services.py 文件源码 项目:bitstore 作者: datahq 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def setUp(self):
        self.addCleanup(patch.stopall)

    # Tests
test_vm.py 文件源码 项目:pyqubes 作者: tommilligan 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def setUp(self):
        self.echo_patch = patch.object(pyqubes.enact, 'echo').start()
        self.call_patch = patch.object(pyqubes.enact, 'call').start()
        self.addCleanup(patch.stopall)
test_vm.py 文件源码 项目:pyqubes 作者: tommilligan 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def setUp(self):
        self.enact_patch = patch.object(pyqubes.vm.VM, 'enact').start()
        self.addCleanup(patch.stopall)
        self.vm = pyqubes.vm.VM("bounding")
test_vm.py 文件源码 项目:pyqubes 作者: tommilligan 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def setUp(self):
        self.enter_patch = patch.object(pyqubes.vm.VM, 'firewall_open').start()
        self.exit_patch = patch.object(pyqubes.vm.VM, 'firewall_close').start()
        self.addCleanup(patch.stopall)
        self.vm = pyqubes.vm.TemplateVM("magic")
test_vm.py 文件源码 项目:pyqubes 作者: tommilligan 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def setUp(self):
        self.enter_patch = patch.object(pyqubes.vm.VM, 'start').start()
        self.exit_patch = patch.object(pyqubes.vm.VM, 'shutdown').start()
        self.addCleanup(patch.stopall)
        self.vm = pyqubes.vm.TemplateVM("magic")
test_vm.py 文件源码 项目:pyqubes 作者: tommilligan 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def setUp(self):
        self.enact_patch = patch.object(pyqubes.vm.VM, 'enact').start()
        self.addCleanup(patch.stopall)
test_enact.py 文件源码 项目:pyqubes 作者: tommilligan 项目源码 文件源码 阅读 97 收藏 0 点赞 0 评论 0
def setUp(self):
        self.print_patch = patch.object(six, 'print_').start()
        self.addCleanup(patch.stopall)
base.py 文件源码 项目:dpm-py 作者: oki-archive 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _post_teardown(self):
        """
        Disable all mocks after the test.
        """
        if self.mock_requests:
            responses.reset()
            responses.stop()
        patch.stopall()
test_scope.py 文件源码 项目:auth-srv 作者: openpermissions 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def tearDown(self):
        super(TestScope, self).tearDown()
        patch.stopall()
test_blueprint.py 文件源码 项目:metastore 作者: datahq 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def setUp(self):
        self.addCleanup(patch.stopall)
        self.controllers = patch.object(module, 'controllers').start()

    # Tests
test_cart.py 文件源码 项目:django-easycart 作者: nevimov 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def setUp(self):
        fill_db()
        request = request_factory.post('')
        request.session = SessionStore()
        set_up_session(request.session)
        cart = Cart(request)
        mock_update = Mock(wraps=cart.update)
        patch.object(cart, 'update', mock_update).start()
        self.addCleanup(patch.stopall)
        self.mock_update = mock_update
        self.request = request
        self.cart = cart
        self.cart_session = request.session[SESSION_KEY]
test_copytool_monitor.py 文件源码 项目:intel-manager-for-lustre 作者: intel-hpdd 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def setUp(self):
        super(CopytoolMonitorTestCase, self).setUp()

        self.client = Mock()

        self.copytool = Mock()
        self.copytool.event_fifo = '/var/spool/test-fifo'

        self.monitor = CopytoolMonitor(self.client, self.copytool)

        self.addCleanup(patch.stopall)
test_base.py 文件源码 项目:koi 作者: openpermissions 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def teardown_module(module):
    """Stop patches and enable logging output"""
    patch.stopall()
    logging.disable(logging.NOTSET)
test_settings.py 文件源码 项目:globomap-driver-acs 作者: globocom 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def tearDown(self):
        patch.stopall()
test_rabbitmq.py 文件源码 项目:globomap-driver-acs 作者: globocom 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def tearDown(self):
        patch.stopall()
test_cloudstack_driver.py 文件源码 项目:globomap-driver-acs 作者: globocom 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def tearDown(self):
        patch.stopall()
test_load.py 文件源码 项目:globomap-driver-acs 作者: globocom 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def tearDown(self):
        patch.stopall()
test_csv_reader.py 文件源码 项目:globomap-driver-acs 作者: globocom 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def tearDown(self):
        patch.stopall()


问题


面经


文章

微信
公众号

扫码关注公众号