mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[copybara] Resync with mostrobotpy (#8662)
This commit is contained in:
@@ -17,9 +17,7 @@ def group_name(request):
|
||||
AlertSim.resetData()
|
||||
|
||||
|
||||
def get_active_alerts(
|
||||
group_name: str, level: Alert.Level
|
||||
) -> T.List[str]:
|
||||
def get_active_alerts(group_name: str, level: Alert.Level) -> T.List[str]:
|
||||
return [
|
||||
a.text
|
||||
for a in AlertSim.getAll()
|
||||
@@ -27,13 +25,14 @@ def get_active_alerts(
|
||||
]
|
||||
|
||||
|
||||
def is_alert_active(
|
||||
group_name: str, text: str, level: Alert.Level
|
||||
):
|
||||
def is_alert_active(group_name: str, text: str, level: Alert.Level):
|
||||
matches = [
|
||||
a
|
||||
for a in AlertSim.getAll()
|
||||
if a.group == group_name and a.level == level and a.text == text and a.isActive()
|
||||
if a.group == group_name
|
||||
and a.level == level
|
||||
and a.text == text
|
||||
and a.isActive()
|
||||
]
|
||||
return len(matches) > 0
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ def test_remove_op_mode():
|
||||
assert options[0].name == "OneArgOpMode"
|
||||
|
||||
|
||||
# @pytest.mark.xfail(reason="wpilib bug")
|
||||
@pytest.mark.xfail(reason="wpilib bug")
|
||||
def test_none_periodic():
|
||||
class MyMockRobot(MockRobot):
|
||||
def __init__(self):
|
||||
|
||||
@@ -166,6 +166,26 @@ def test_robot_failure_output(robot):
|
||||
assert robot_pid_one != robot_pid_two
|
||||
|
||||
|
||||
def test_isolated_plugin_assertion_rendering(pytester):
|
||||
_make_robot_module(pytester)
|
||||
_configure_isolated_plugin(pytester)
|
||||
pytester.makepyfile(test_isolated="""
|
||||
def test_robot_assertion_rendering(robot):
|
||||
assert "x" == "y"
|
||||
""")
|
||||
|
||||
result = pytester.runpytest_subprocess("-vv")
|
||||
|
||||
result.assert_outcomes(failed=1)
|
||||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
"*test_isolated.py::test_robot_assertion_rendering FAILED*",
|
||||
"*assert 'x' == 'y'*",
|
||||
]
|
||||
)
|
||||
assert not any("_pytest/config/__init__.py" in line for line in result.outlines)
|
||||
|
||||
|
||||
def test_isolated_plugin_no_duplicate_verbose_output(pytester):
|
||||
_make_robot_module(pytester)
|
||||
_configure_isolated_plugin(pytester)
|
||||
|
||||
Reference in New Issue
Block a user