Пример #1
0
 def __init__(self,
              name,
              logger=None,
              victim_alive_check_delay=0.3,
              config=None):
     super(TestActor, self).__init__(name, logger, victim_alive_check_delay)
     self.call_count = {}
     if config is None:
         config = {}
     self.config = Config(name, config)
Пример #2
0
class TestActor(KittyActorInterface):
    def __init__(self,
                 name,
                 logger=None,
                 victim_alive_check_delay=0.3,
                 config=None):
        super(TestActor, self).__init__(name, logger, victim_alive_check_delay)
        self.call_count = {}
        if config is None:
            config = {}
        self.config = Config(name, config)

    def get_call_count(self, func):
        if func in self.call_count:
            return self.call_count[func]
        return 0

    @count_calls('setup')
    def setup(self):
        super(TestActor, self).setup()

    @count_calls('teardown')
    def teardown(self):
        super(TestActor, self).teardown()

    @count_calls('pre_test')
    def pre_test(self, test_number):
        self.config.set_test(test_number)
        super(TestActor, self).pre_test(test_number)

    @count_calls('post_test')
    def post_test(self):
        super(TestActor, self).post_test()

    @count_calls('get_report')
    def get_report(self):
        self.config.set_func('report')
        report = self.report
        config_report = self.config.get_vals()
        if config_report:
            self.logger.debug('found matching config: %s', repr(config_report))
            for k, v in config_report.iteritems():
                if k.lower() == 'status':
                    report.set_status(v)
                else:
                    report.add(k, v)
        return report

    @count_calls('is_victim_alive')
    def is_victim_alive(self):
        return super(TestActor, self).is_victim_alive()

    @count_calls('trigger')
    def trigger(self):
        pass
Пример #3
0
class TestActor(KittyActorInterface):

    def __init__(self, name, logger=None, victim_alive_check_delay=0.3, config=None):
        super(TestActor, self).__init__(name, logger, victim_alive_check_delay)
        self.call_count = {}
        if config is None:
            config = {}
        self.config = Config(name, config)

    def get_call_count(self, func):
        if func in self.call_count:
            return self.call_count[func]
        return 0

    @count_calls('setup')
    def setup(self):
        super(TestActor, self).setup()

    @count_calls('teardown')
    def teardown(self):
        super(TestActor, self).teardown()

    @count_calls('pre_test')
    def pre_test(self, test_number):
        self.config.set_test(test_number)
        super(TestActor, self).pre_test(test_number)

    @count_calls('post_test')
    def post_test(self):
        super(TestActor, self).post_test()

    @count_calls('get_report')
    def get_report(self):
        self.config.set_func('report')
        report = self.report
        config_report = self.config.get_vals()
        if config_report:
            self.logger.debug('found matching config: %s', repr(config_report))
            for k, v in config_report.items():
                if k.lower() == 'status':
                    report.set_status(v)
                else:
                    report.add(k, v)
        return report

    @count_calls('is_victim_alive')
    def is_victim_alive(self):
        return super(TestActor, self).is_victim_alive()

    @count_calls('trigger')
    def trigger(self):
        pass
Пример #4
0
 def __init__(self, name, logger=None, victim_alive_check_delay=0.3, config=None):
     super(TestActor, self).__init__(name, logger, victim_alive_check_delay)
     self.call_count = {}
     if config is None:
         config = {}
     self.config = Config(name, config)