forked from robotpy/robotpy-commands-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_commandgroup_error.py
38 lines (26 loc) · 1.09 KB
/
test_commandgroup_error.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
from typing import TYPE_CHECKING
import commands2
from util import * # type: ignore
if TYPE_CHECKING:
from .util import *
import pytest
def test_commandInMultipleGroups():
command1 = commands2.Command()
command2 = commands2.Command()
commands2.ParallelCommandGroup(command1, command2)
with pytest.raises(commands2.IllegalCommandUse):
commands2.ParallelCommandGroup(command1, command2)
def test_commandInGroupExternallyScheduled(scheduler: commands2.CommandScheduler):
command1 = commands2.Command()
command2 = commands2.Command()
commands2.ParallelCommandGroup(command1, command2)
with pytest.raises(commands2.IllegalCommandUse):
scheduler.schedule(command1)
@pytest.mark.skipif(IS_OLD_COMMANDS, reason="not in old commands")
def test_redecoratedCommandError(scheduler: commands2.CommandScheduler):
command = commands2.InstantCommand()
command.withTimeout(10).until(lambda: False)
with pytest.raises(commands2.IllegalCommandUse):
command.withTimeout(10)
scheduler.removeComposedCommands([command])
command.withTimeout(10)