forked from buildbot/buildbot
-
Notifications
You must be signed in to change notification settings - Fork 6
/
test_schedulers_basic_Scheduler.py
36 lines (28 loc) · 1.02 KB
/
test_schedulers_basic_Scheduler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from twisted.trial import unittest
from buildbot.schedulers import basic
class FakeDBConnector(object):
pass
class FakeSchedulerManager(object):
def __init__(self):
self.db = FakeDBConnector()
class Scheduler(unittest.TestCase):
def makeScheduler(self, **kwargs):
"""Set up a new scheduler with a fake environment; also adds default
constructor args for convenience"""
defaultargs = dict(
name="tsched",
branch=None,
treeStableTimer=60,
builderNames=['tbuild'])
defaultargs.update(kwargs)
sch = basic.Scheduler(**defaultargs)
# NOTE: this doesn't actually call setServiceParent or start()
sch.parent = FakeSchedulerManager()
return sch
def test_constructor_simple(self):
sch = basic.Scheduler(
name="tsched",
branch=None,
treeStableTimer=60,
builderNames=['tbuild'])
self.assertEqual(sch.name, "tsched")