forked from M-Labs/artiq
test/scheduler: fix
This commit is contained in:
parent
72a993afe0
commit
1fc51f32ed
|
@ -63,6 +63,16 @@ def _get_basic_steps(rid, expid, priority=0, flush=False):
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class _RIDCounter:
|
||||||
|
def __init__(self, next_rid):
|
||||||
|
self._next_rid = next_rid
|
||||||
|
|
||||||
|
def get(self):
|
||||||
|
rid = self._next_rid
|
||||||
|
self._next_rid += 1
|
||||||
|
return rid
|
||||||
|
|
||||||
|
|
||||||
class SchedulerCase(unittest.TestCase):
|
class SchedulerCase(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
|
@ -73,7 +83,7 @@ class SchedulerCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_steps(self):
|
def test_steps(self):
|
||||||
loop = self.loop
|
loop = self.loop
|
||||||
scheduler = Scheduler(0, dict(), None)
|
scheduler = Scheduler(_RIDCounter(0), dict(), None)
|
||||||
expid = _get_expid("EmptyExperiment")
|
expid = _get_expid("EmptyExperiment")
|
||||||
|
|
||||||
expect = _get_basic_steps(1, expid)
|
expect = _get_basic_steps(1, expid)
|
||||||
|
@ -121,7 +131,7 @@ class SchedulerCase(unittest.TestCase):
|
||||||
handlers = {
|
handlers = {
|
||||||
"update_dataset": check_termination
|
"update_dataset": check_termination
|
||||||
}
|
}
|
||||||
scheduler = Scheduler(0, handlers, None)
|
scheduler = Scheduler(_RIDCounter(0), handlers, None)
|
||||||
|
|
||||||
expid_bg = _get_expid("BackgroundExperiment")
|
expid_bg = _get_expid("BackgroundExperiment")
|
||||||
expid = _get_expid("EmptyExperiment")
|
expid = _get_expid("EmptyExperiment")
|
||||||
|
@ -165,7 +175,7 @@ class SchedulerCase(unittest.TestCase):
|
||||||
|
|
||||||
def test_flush(self):
|
def test_flush(self):
|
||||||
loop = self.loop
|
loop = self.loop
|
||||||
scheduler = Scheduler(0, dict(), None)
|
scheduler = Scheduler(_RIDCounter(0), dict(), None)
|
||||||
expid = _get_expid("EmptyExperiment")
|
expid = _get_expid("EmptyExperiment")
|
||||||
|
|
||||||
expect = _get_basic_steps(1, expid, 1, True)
|
expect = _get_basic_steps(1, expid, 1, True)
|
||||||
|
|
Loading…
Reference in New Issue