yandex-tank/Tests/TankTests.py

44 lines
1.1 KiB
Python
Raw Normal View History

2012-09-12 13:18:58 +00:00
import logging
import sys
2012-09-21 11:47:37 +00:00
import tempfile
2012-09-25 13:59:58 +00:00
import unittest
2012-09-12 13:18:58 +00:00
2013-11-25 13:45:18 +00:00
from Tank.Plugins.Aggregator import SecondAggregateData, \
SecondAggregateDataTotalItem
from tankcore import TankCore
2012-09-12 13:18:58 +00:00
class TankTestCase(unittest.TestCase):
formatter = logging.Formatter("%(asctime)s [%(levelname)s] %(name)s\t%(message)s")
logger = logging.getLogger('')
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
ch.setFormatter(formatter)
logger.addHandler(ch)
logger.debug("Starting Unit Test")
2012-09-18 11:47:04 +00:00
def get_aggregate_data(self, filename):
2012-09-20 06:55:45 +00:00
return SecondAggregateData(SecondAggregateDataTotalItem())
2013-11-25 13:45:18 +00:00
2012-09-18 11:47:04 +00:00
def callback(self, data):
2013-11-25 13:45:18 +00:00
self.data = SecondAggregateData(data)
2012-09-18 11:47:04 +00:00
2012-09-21 11:47:37 +00:00
def get_core(self):
self.core = TankCore()
self.core.artifacts_base_dir = tempfile.mkdtemp()
return self.core
2012-09-12 13:18:58 +00:00
2013-11-25 13:45:18 +00:00
2012-09-12 13:18:58 +00:00
class FakeOptions(object):
2012-09-12 15:55:59 +00:00
log = ''
verbose = True
config = []
option = ['testsection.testoption=testvalue']
ignore_lock = True
2012-09-18 11:47:04 +00:00
lock_fail = False
2012-09-25 13:59:58 +00:00
no_rc = True
2012-10-01 11:23:59 +00:00
manual_start = False
scheduled_start = None
2013-12-20 18:41:02 +00:00
lock_dir = None