• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python call.info函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mock.call.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_update_services

 def test_update_services(self):
     mock_as_foo = Mock(spec_set=AwsLimit)
     mock_as_bar = Mock(spec_set=AwsLimit)
     mock_ec2_baz = Mock(spec_set=AwsLimit)
     mock_vpc = Mock(spec_set=AwsLimit)
     ta_services = {
         'AutoScaling': {
             'foo': mock_as_foo,
             'bar': mock_as_bar
         },
         'EC2': {
             'baz': mock_ec2_baz
         },
         'VPC': {
             'VPC Elastic IP addresses (EIPs)': mock_vpc
         },
     }
     ta_results = {
         'AutoScaling': {
             'foo': 20,
             'bar': 40,
         },
         'EC2': {
             'baz': 5,
             'blam': 10,
         },
         'OtherService': {
             'blarg': 1,
         },
         'VPC': {
             'VPC Elastic IP addresses (EIPs)': 11,
         }
     }
     with patch('awslimitchecker.trustedadvisor'
                '.logger', autospec=True) as mock_logger:
         self.cls.ta_services = ta_services
         self.cls._update_services(ta_results)
     assert mock_logger.mock_calls == [
         call.debug("Updating TA limits on all services"),
         call.info("TrustedAdvisor returned check results for unknown "
                   "limit '%s' (service %s)", 'blam', 'EC2'),
         call.info("TrustedAdvisor returned check results for unknown "
                   "service '%s'", 'OtherService'),
         call.info("Done updating TA limits on all services"),
     ]
     assert mock_as_foo.mock_calls == [
         call._set_ta_limit(20)
     ]
     assert mock_as_bar.mock_calls == [
         call._set_ta_limit(40)
     ]
     assert mock_ec2_baz.mock_calls == [
         call._set_ta_limit(5)
     ]
     assert mock_vpc.mock_calls == [
         call._set_ta_limit(11)
     ]
开发者ID:EslamElHusseiny,项目名称:awslimitchecker,代码行数:57,代码来源:test_trustedadvisor.py


示例2: test_update_services

    def test_update_services(self):

        def se_set(lname, val):
            if lname == 'blam':
                raise ValueError("foo")

        mock_autoscale = Mock(spec_set=_AwsService)
        mock_ec2 = Mock(spec_set=_AwsService)
        mock_ec2._set_ta_limit.side_effect = se_set
        mock_vpc = Mock(spec_set=_AwsService)
        services = {
            'AutoScaling': mock_autoscale,
            'EC2': mock_ec2,
            'VPC': mock_vpc,
        }
        ta_results = {
            'AutoScaling': {
                'foo': 20,
                'bar': 40,
            },
            'EC2': {
                'baz': 5,
                'blam': 10,
            },
            'OtherService': {
                'blarg': 1,
            },
            'VPC': {
                'VPC Elastic IP addresses (EIPs)': 11,
            }
        }
        with patch('awslimitchecker.trustedadvisor'
                   '.logger', autospec=True) as mock_logger:
            self.cls._update_services(ta_results, services)
        assert mock_logger.mock_calls == [
            call.debug("Updating TA limits on all services"),
            call.info("TrustedAdvisor returned check results for unknown "
                      "limit '%s' (service %s)", 'blam', 'EC2'),
            call.info("TrustedAdvisor returned check results for unknown "
                      "service '%s'", 'OtherService'),
            call.info("Done updating TA limits on all services"),
        ]
        assert mock_autoscale.mock_calls == [
            call._set_ta_limit('bar', 40),
            call._set_ta_limit('foo', 20),
        ]
        assert mock_ec2.mock_calls == [
            call._set_ta_limit('baz', 5),
            call._set_ta_limit('blam', 10),
            call._set_ta_limit('VPC Elastic IP addresses (EIPs)', 11)
        ]
开发者ID:pdecat,项目名称:awslimitchecker,代码行数:51,代码来源:test_trustedadvisor.py


示例3: test_load

    def test_load(self):
        self._write_banks()

        self._create_dealer()
        self.dealer.load()

        self.mocked_log.assert_has_calls(
            [
                call.debug("Loading banks"),
                call.info("Loading features bank '%s'", BANK_PATH_1),
                call.info("Loading features bank '%s'", BANK_PATH_2),
            ]
        )
        self.mocked_log.warning.assert_not_called()
开发者ID:nivbend,项目名称:bdd_bot,代码行数:14,代码来源:test_logging.py


示例4: test_poll_dont_have_ta

 def test_poll_dont_have_ta(self):
     self.cls.have_ta = False
     tmp = self.mock_conn.describe_trusted_advisor_check_result
     with patch('%s._get_limit_check_id' % pb, autospec=True) as mock_id:
         with patch('awslimitchecker.trustedadvisor'
                    '.logger', autospec=True) as mock_logger:
             res = self.cls._poll()
     assert tmp.mock_calls == []
     assert mock_id.mock_calls == [
         call(self.cls)
     ]
     assert mock_logger.mock_calls == [
         call.info('Beginning TrustedAdvisor poll'),
         call.info('TrustedAdvisor.have_ta is False; not polling TA')
     ]
     assert res == {}
开发者ID:EmilVarona,项目名称:awslimitchecker,代码行数:16,代码来源:test_trustedadvisor.py


示例5: test_healthcheck_no_active

    def test_healthcheck_no_active(self):
        type(self.mock_redir).active_node_ip_port = None
        type(self.mock_redir).log_enabled = True
        if sys.version_info[0] < 3:
            type(self.mock_request).uri = '/vault-redirector-health'
            type(self.mock_request).path = '/vault-redirector-health'
            expected = 'foobar'
            expected_msg = 'No Active Vault'
        else:
            # in py3 these are byte literals
            type(self.mock_request).uri = b'/vault-redirector-health'
            type(self.mock_request).path = b'/vault-redirector-health'
            expected = b'foobar'
            expected_msg = b'No Active Vault'

        with patch('%s.logger' % pbm) as mock_logger:
            with patch('%s.VaultRedirectorSite.status_response' % pbm
                       ) as mock_status:
                mock_status.return_value = 'foobar'
                resp = self.cls.healthcheck(self.mock_request)
        assert self.mock_request.mock_calls == [
            call.setResponseCode(503, message=expected_msg),
            call.setHeader("Content-Type", "application/json")
        ]
        assert resp == expected
        assert mock_logger.mock_calls == [
            call.info('RESPOND %d for %s%s request for /vault-redirector-health'
                      ' from %s:%s', 503, '', 'GET', '1.2.3.4', 12345)
        ]
开发者ID:jantman,项目名称:vault-redirector-twisted,代码行数:29,代码来源:test_redirector.py


示例6: test_get_api_id_aws

    def test_get_api_id_aws(self):

        def se_exc(*args, **kwargs):
            raise Exception()

        conf = Mock()
        args = Mock(tf_path='tfpath')
        with patch.multiple(
            pbm,
            autospec=True,
            logger=DEFAULT,
            TerraformRunner=DEFAULT,
            AWSInfo=DEFAULT
        ) as mocks:
            mocks['TerraformRunner'].return_value._get_outputs.side_effect = \
                se_exc
            mocks['AWSInfo'].return_value.get_api_id.return_value = 'myaid'
            res = get_api_id(conf, args)
        assert res == 'myaid'
        assert mocks['TerraformRunner'].mock_calls == [
            call(conf, 'tfpath'),
            call()._get_outputs()
        ]
        assert mocks['AWSInfo'].mock_calls == [
            call(conf),
            call().get_api_id()
        ]
        assert mocks['logger'].mock_calls == [
            call.debug('Trying to get Terraform rest_api_id output'),
            call.info('Unable to find API rest_api_id from Terraform state; '
                      'querying AWS.', exc_info=1),
            call.debug('AWS API ID: \'%s\'', 'myaid')
        ]
开发者ID:jantman,项目名称:webhook2lambda2sqs,代码行数:33,代码来源:test_runner.py


示例7: test_connect

    def test_connect(self):
        mock_conn = Mock()
        mock_cc = Mock()
        type(mock_cc).region_name = 'myregion'
        type(mock_conn)._client_config = mock_cc

        cls = ConnectableTester()
        cls.api_name = 'myapi'
        kwargs = {'foo': 'fooval', 'bar': 'barval'}

        with patch('%s._boto3_connection_kwargs' % pb,
                   new_callable=PropertyMock, create=True) as mock_kwargs:
            mock_kwargs.return_value = kwargs
            with patch('%s.logger' % pbm) as mock_logger:
                with patch('%s.boto3.client' % pbm) as mock_client:
                    mock_client.return_value = mock_conn
                    cls.connect()
        assert mock_kwargs.mock_calls == [call()]
        assert mock_logger.mock_calls == [
            call.info("Connected to %s in region %s",
                      'myapi',
                      'myregion')
        ]
        assert mock_client.mock_calls == [
            call(
                'myapi',
                foo='fooval',
                bar='barval'
            )
        ]
        assert cls.conn == mock_client.return_value
开发者ID:jantman,项目名称:awslimitchecker,代码行数:31,代码来源:test_connectable.py


示例8: test_handle_input_on

    def test_handle_input_on(self):
        mock_evt = Mock(spec_set=InterruptEvent)
        type(mock_evt).pin_num = 3
        type(mock_evt).timestamp = 1234.5678

        self.cls.current_values = [5, 5, 5, 5]

        with patch('%s.handle_change' % pb) as mock_handle:
            with patch('%s.logger' % pbm) as mock_logger:
                with patch('%s.no_state_change' % pb) as mock_no_change:
                    with patch('%s.set_output' % pb) as mock_set:
                        mock_no_change.return_value = False
                        self.cls.handle_input_on(mock_evt)
        assert mock_logger.mock_calls == [
            call.info("Received ON event for pin %s", 3),
        ]
        assert mock_handle.mock_calls == [call(3, 1, 1234.5678)]
        assert self.mock_chip.mock_calls == []
        assert self.opin0.mock_calls == []
        assert self.opin1.mock_calls == []
        assert self.opin2.mock_calls == []
        assert self.opin3.mock_calls == []
        assert self.cls.current_values == [5, 5, 5, 1]
        assert mock_no_change.mock_calls == [call(3, 1)]
        assert mock_set.mock_calls == [call(3, 1)]
开发者ID:jantman,项目名称:piface-webhooks,代码行数:25,代码来源:test_listener.py


示例9: test_dont_log_stderr_on_success_if_disabled

    def test_dont_log_stderr_on_success_if_disabled(self, proc, file, logger):
        proc.return_value.returncode = 0
        file.return_value = BytesIO(b'stderr')
        job = TestLogStderrOnFailureOnlyTask()
        job.run()

        self.assertNotIn(call.info('Program stderr:\nstderr'), logger.mock_calls)
开发者ID:Houzz,项目名称:luigi,代码行数:7,代码来源:external_program_test.py


示例10: test_render

    def test_render(self):
        expected_location = 'http://mynode:1234/foo/bar'
        expected_server = 'vault-redirector/%s/TwistedWeb/16.1.0' % _VERSION
        if sys.version_info[0] < 3:
            type(self.mock_request).uri = '/foo/bar'
            type(self.mock_request).path = '/foo/bar'
        else:
            # in py3 these are byte literals
            type(self.mock_request).uri = b'/foo/bar'
            type(self.mock_request).path = b'/foo/bar'
        self.mock_request.reset_mock()

        with patch('%s.logger' % pbm) as mock_logger:
            resp = self.cls.render(self.mock_request)
        assert self.mock_request.mock_calls == [
            call.setHeader('server', expected_server),
            call.setResponseCode(307),
            call.setHeader('Location', expected_location),
            call.setHeader("Content-Type", "text/html; charset=UTF-8")
        ]
        assert resp == self.empty_resp
        assert mock_logger.mock_calls == [
            call.info('RESPOND 307 to %s for %s%s request for %s from %s:%s',
                      expected_location, '', 'GET', '/foo/bar', '1.2.3.4',
                      12345)
        ]
开发者ID:jantman,项目名称:vault-redirector-twisted,代码行数:26,代码来源:test_redirector.py


示例11: test_register_callbacks

 def test_register_callbacks(self):
     mock_listener = Mock(spec_set=InputEventListener)
     self.cls.listener = mock_listener
     with patch('%s.logger' % pbm) as mock_logger:
         self.cls.register_callbacks()
     assert mock_logger.mock_calls == [
         call.debug("registering callbacks"),
         call.debug('registering callback for %s ON', 0),
         call.debug('registering callback for %s OFF', 0),
         call.debug('registering callback for %s ON', 1),
         call.debug('registering callback for %s OFF', 1),
         call.debug('registering callback for %s ON', 2),
         call.debug('registering callback for %s OFF', 2),
         call.debug('registering callback for %s ON', 3),
         call.debug('registering callback for %s OFF', 3),
         call.debug('done registering callbacks'),
         call.info('Initial pin states: %s', [10, 11, 12, 13])
     ]
     assert mock_listener.mock_calls == [
         call.register(0, IODIR_ON, self.cls.handle_input_on),
         call.register(0, IODIR_OFF, self.cls.handle_input_off),
         call.register(1, IODIR_ON, self.cls.handle_input_on),
         call.register(1, IODIR_OFF, self.cls.handle_input_off),
         call.register(2, IODIR_ON, self.cls.handle_input_on),
         call.register(2, IODIR_OFF, self.cls.handle_input_off),
         call.register(3, IODIR_ON, self.cls.handle_input_on),
         call.register(3, IODIR_OFF, self.cls.handle_input_off),
     ]
     assert self.cls.current_values == [10, 11, 12, 13]
开发者ID:jantman,项目名称:piface-webhooks,代码行数:29,代码来源:test_listener.py


示例12: test_set_account_info_env

 def test_set_account_info_env(self):
     self.cls.aws_account_id = None
     self.cls.aws_region = None
     with patch('%s.logger' % pbm, autospec=True) as mock_logger:
         with patch('%s.client' % pbm, autospec=True) as mock_client:
             mock_client.return_value.get_user.return_value = {
                 'User': {'Arn': 'arn:aws:iam::123456789:user/foo'}
             }
             type(mock_client.return_value)._client_config = Mock(
                 region_name='myregion')
             with patch.dict(
                     '%s.os.environ' % pbm,
                     {'AWS_REGION': 'ar'},
                     clear=True):
                 self.cls._set_account_info()
     assert self.cls.aws_account_id == '123456789'
     assert self.cls.aws_region == 'myregion'
     assert mock_client.mock_calls == [
         call('iam', region_name='ar'),
         call().get_user(),
         call('lambda', region_name='ar')
     ]
     assert mock_logger.mock_calls == [
         call.debug('Connecting to IAM with region_name=%s', 'ar'),
         call.info('Found AWS account ID as %s; region: %s',
                   '123456789', 'myregion')
     ]
开发者ID:waffle-iron,项目名称:webhook2lambda2sqs,代码行数:27,代码来源:test_tf_generator.py


示例13: test_clone_repo_dry_run

    def test_clone_repo_dry_run(self):
        type(self.bi).ssh_clone_url = 'ssh_url'
        type(self.bi).https_clone_url = 'https_url'
        self.cls.dry_run = True
        ex = Exception('foo')

        def se_clone(url, path, branch=None):
            if url == 'ssh_url':
                raise ex
            return True

        with patch('%s.path_for_repo' % pb) as mock_path, \
                patch('%s.Repo' % pbm) as mock_repo, \
                patch('%s.logger' % pbm) as mock_logger:
            mock_path.return_value = '/repo/path'
            mock_repo.clone_from.side_effect = se_clone
            res = self.cls.clone_repo()
        assert mock_path.mock_calls == [call()]
        assert mock_repo.mock_calls == []
        assert mock_logger.mock_calls == [
            call.debug("Cloning %s branch %s into: %s", 'my/repo', 'master',
                       '/repo/path'),
            call.info("DRY RUN - not actually cloning %s into %s", 'my/repo',
                      '/repo/path')
        ]
        assert res == ('/repo/path', '(DRY RUN)')
开发者ID:jantman,项目名称:rebuildbot,代码行数:26,代码来源:test_local_build.py


示例14: test_update_limits_from_api_low_max_instances

    def test_update_limits_from_api_low_max_instances(self):
        fixtures = result_fixtures.VPC()
        response = fixtures.test_update_limits_from_api_low_max_instances

        mock_conn = Mock()
        mock_client_conn = Mock()
        mock_client_conn.describe_account_attributes.return_value = response

        cls = _VpcService(21, 43)
        cls.resource_conn = mock_conn
        cls.conn = mock_client_conn
        with patch('awslimitchecker.services.vpc.logger') as mock_logger:
            cls._update_limits_from_api()
        assert mock_conn.mock_calls == []
        assert mock_client_conn.mock_calls == [
            call.describe_account_attributes()
        ]
        assert mock_logger.mock_calls == [
            call.info("Querying EC2 DescribeAccountAttributes for limits"),
            call.debug('Done setting limits from API')
        ]

        limit_name = 'Network interfaces per Region'
        assert cls.limits[limit_name].api_limit is None
        assert cls.limits[limit_name].get_limit() == DEFAULT_ENI_LIMIT
开发者ID:jantman,项目名称:awslimitchecker,代码行数:25,代码来源:test_vpc.py


示例15: test_run

    def test_run(self):
        def se_ras(klass):
            if mock_ras.call_count < 4:
                return None
            raise RuntimeError()

        with patch('%s.read_and_send' % pb, autospec=True) as mock_ras:
            with patch('%s.sleep' % pbm, autospec=True) as mock_sleep:
                with patch('%s.logger' % pbm, autospec=True) as mock_logger:
                    mock_ras.side_effect = se_ras
                    with pytest.raises(RuntimeError):
                        self.cls.run()
        assert mock_ras.mock_calls == [
            call(self.cls),
            call(self.cls),
            call(self.cls),
            call(self.cls)
        ]
        assert mock_sleep.mock_calls == [
            call(60.0),
            call(60.0),
            call(60.0)
        ]
        assert mock_logger.mock_calls == [
            call.info('Running sensor daemon loop...'),
            call.debug('Sleeping %ss', 60.0),
            call.debug('Sleeping %ss', 60.0),
            call.debug('Sleeping %ss', 60.0)
        ]
开发者ID:jantman,项目名称:RPyMostat-sensor,代码行数:29,代码来源:test_sensor_daemon.py


示例16: test_discover_owfs

    def test_discover_owfs(self):
        self.cls.owfs_paths = ['/foo', '/bar', '/baz']

        def se_exists(path):
            if path.startswith('/baz'):
                return True
            if path == '/bar':
                return True
            return False

        with patch('%s.logger' % pbm, autospec=True) as mock_logger:
            with patch('%s.os.path.exists' % pbm, autospec=True) as mock_ex:
                mock_ex.side_effect = se_exists
                res = self.cls._discover_owfs()
        assert res == '/baz'
        assert mock_ex.mock_calls == [
            call('/foo'),
            call('/bar'),
            call('/bar/settings/units/temperature_scale'),
            call('/baz'),
            call('/baz/settings/units/temperature_scale')
        ]
        assert mock_logger.mock_calls == [
            call.debug('Attempting to find OWFS path/mountpoint from list '
                       'of common options: %s', ['/foo', '/bar', '/baz']),
            call.debug('Path %s does not exist; skipping', '/foo'),
            call.debug('Path %s exists but does not appear to have OWFS '
                       'mounted', '/bar'),
            call.info('Found OWFS mounted at: %s', '/baz')
        ]
开发者ID:jantman,项目名称:RPyMostat-sensor,代码行数:30,代码来源:test_owfs.py


示例17: test_connect_resource

    def test_connect_resource(self):
        mock_conn = Mock()
        mock_meta = Mock()
        mock_client = Mock()
        mock_cc = Mock()
        type(mock_cc).region_name = 'myregion'
        type(mock_client)._client_config = mock_cc
        type(mock_meta).client = mock_client
        type(mock_conn).meta = mock_meta

        cls = ConnectableTester()
        cls.api_name = 'myapi'
        kwargs = {'foo': 'fooval', 'bar': 'barval'}

        with patch('%s._boto3_connection_kwargs' % pb,
                   new_callable=PropertyMock) as mock_kwargs:
            mock_kwargs.return_value = kwargs
            with patch('%s.logger' % pbm) as mock_logger:
                with patch('%s.boto3.resource' % pbm) as mock_resource:
                    mock_resource.return_value = mock_conn
                    cls.connect_resource()
        assert mock_kwargs.mock_calls == [call()]
        assert mock_logger.mock_calls == [
            call.info("Connected to %s (resource) in region %s",
                      'myapi',
                      'myregion')
        ]
        assert mock_resource.mock_calls == [
            call(
                'myapi',
                foo='fooval',
                bar='barval'
            )
        ]
        assert cls.resource_conn == mock_resource.return_value
开发者ID:bflad,项目名称:awslimitchecker,代码行数:35,代码来源:test_connectable.py


示例18: test_load_default_file

    def test_load_default_file(self):
        default_file = '''{'Axes_set_ylabel': {'fontsize': 10}, 'wlevels_Axes_plot': {'DEFAULT': {'marker': 'v', 'markersize': 6, 'linewidth': 1, 'linestyle': '-'}}, 'geology_Axes_bar': {'edgecolor': 'black'}, 'obsid_Axes_bar': {'edgecolor': 'black', 'linewidth': 0.5, 'fill': False}, 'dems_Axes_plot': {'DEFAULT': {'marker': 'None', 'linewidth': 1, 'linestyle': '-'}}, 'Axes_set_xlabel': {'fontsize': 10}, 'Axes_set_ylim': None, 'plot_width': None, 'grid_Axes_grid': {'color': '0.65', 'b': True, 'linestyle': '-', 'which': 'both'}, 'legend_Axes_legend': {'loc': 0, 'framealpha': 1, 'fontsize': 10}, 'legend_Frame_set_fill': False, 'plot_height': None, 'layer_Axes_annotate': {'va': 'center', 'xytext': (5, 0), 'fontsize': 9, 'bbox': {'alpha': 0.6, 'fc': 'white', 'boxstyle': 'square,pad=0.05', 'edgecolor': 'white'}, 'ha': 'left', 'textcoords': 'offset points'}, 'ticklabels_Text_set_fontsize': {'fontsize': 10}, 'legend_Text_set_fontsize': 10, 'Figure_subplots_adjust': {}, 'Axes_set_xlim': None, 'obsid_Axes_annotate': {'va': 'top', 'xytext': (0, 10), 'fontsize': 9, 'bbox': {'alpha': 0.4, 'fc': 'white', 'boxstyle': 'square,pad=0.05', 'edgecolor': 'white'}, 'rotation': 0, 'ha': 'center', 'textcoords': 'offset points'}, 'drillstop_Axes_plot': {'color': 'black', 'marker': '^', 'markersize': 8, 'linestyle': ''}, 'legend_Frame_set_facecolor': '1'}'''
        as_dict = ast.literal_eval(default_file)

        self.midvatten.ms.settingsdict['secplot_loaded_template'] = ''

        with utils.tempinput(default_file, 'utf-8') as f1:

            @mock.patch('midvatten_utils.MessagebarAndLog')
            @mock.patch('os.path.join')
            def _test(self, filename, mock_join, mock_messagebar):
                mock_join.return_value = filename
                self.midvatten.ms.settingsdict['secplot_templates'] = filename
                secplottemplates = PlotTemplates(self.sectionplot, self.template_list, self.edit_button,
                                                 self.load_button,
                                                 self.save_as_button, self.import_button, self.remove_button,
                                                 self.template_folder, 'secplot_templates', 'secplot_loaded_template',
                                                 defs.secplot_default_template(), self.midvatten.ms)

                return secplottemplates, mock_messagebar

            secplottemplates, mock_messagebar = _test(self, f1)

        assert call.info(log_msg='Loaded template from default template file.') in mock_messagebar.mock_calls
        assert utils.anything_to_string_representation(secplottemplates.loaded_template) == utils.anything_to_string_representation(as_dict)
开发者ID:jkall,项目名称:qgis-midvatten-plugin,代码行数:25,代码来源:test_sectionplot_templates.py


示例19: test_log_stderr_on_success_by_default

    def test_log_stderr_on_success_by_default(self, proc, file, logger):
        proc.return_value.returncode = 0
        file.return_value = BytesIO(b'stderr')
        job = TestExternalProgramTask()
        job.run()

        self.assertIn(call.info('Program stderr:\nstderr'), logger.mock_calls)
开发者ID:Houzz,项目名称:luigi,代码行数:7,代码来源:external_program_test.py


示例20: test_handle_input_off_no_change

    def test_handle_input_off_no_change(self):
        mock_evt = Mock(spec_set=InterruptEvent)
        type(mock_evt).pin_num = 1
        type(mock_evt).timestamp = 1234.5678

        self.cls.current_values = [5, 0, 5, 5]

        with patch('%s.handle_change' % pb) as mock_handle:
            with patch('%s.logger' % pbm) as mock_logger:
                with patch('%s.no_state_change' % pb) as mock_no_change:
                    with patch('%s.set_output' % pb) as mock_set:
                        mock_no_change.return_value = True
                        self.cls.handle_input_off(mock_evt)
        assert mock_logger.mock_calls == [
            call.info("Ignoring duplicate event for pin %s state %s",
                      1, 0)
        ]
        assert mock_handle.mock_calls == []
        assert self.mock_chip.mock_calls == []
        assert self.opin0.mock_calls == []
        assert self.opin1.mock_calls == []
        assert self.opin2.mock_calls == []
        assert self.opin3.mock_calls == []
        assert self.cls.current_values == [5, 0, 5, 5]
        assert mock_no_change.mock_calls == [call(1, 0)]
        assert mock_set.mock_calls == []
开发者ID:jantman,项目名称:piface-webhooks,代码行数:26,代码来源:test_listener.py



注:本文中的mock.call.info函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python call.insert_definition函数代码示例发布时间:2022-05-27
下一篇:
Python call.debug函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap