forked from robotpy/robotpy-commands-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_proxycommand.py
40 lines (25 loc) · 964 Bytes
/
test_proxycommand.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
37
38
39
40
from typing import TYPE_CHECKING
import commands2
from util import * # type: ignore
if TYPE_CHECKING:
from .util import *
import pytest
@pytest.mark.skipif(IS_OLD_COMMANDS, reason="not in old commands")
def test_proxyCommandSchedule(scheduler: commands2.CommandScheduler):
command1 = commands2.Command()
start_spying_on(command1)
scheduleCommand = commands2.ProxyCommand(command1)
scheduler.schedule(scheduleCommand)
verify(command1).schedule()
@pytest.mark.skipif(IS_OLD_COMMANDS, reason="not in old commands")
def test_proxyCommandEnd(scheduler: commands2.CommandScheduler):
cond = OOBoolean()
command = commands2.WaitUntilCommand(cond)
scheduleCommand = commands2.ProxyCommand(command)
scheduler.schedule(scheduleCommand)
scheduler.run()
assert scheduler.isScheduled(scheduleCommand)
cond.set(True)
scheduler.run()
scheduler.run()
assert not scheduler.isScheduled(scheduleCommand)