2025-10-24 01:28:04 -04:00
|
|
|
import logging
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
import ntcore
|
|
|
|
|
import wpilib
|
|
|
|
|
from wpilib.simulation._simulation import _resetWpilibSimulationData
|
|
|
|
|
|
2026-01-12 22:11:02 -05:00
|
|
|
pytest_plugins = "pytester"
|
|
|
|
|
|
2025-10-24 01:28:04 -04:00
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
|
def cfg_logging(caplog):
|
|
|
|
|
caplog.set_level(logging.INFO)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="function")
|
|
|
|
|
def wpilib_state():
|
|
|
|
|
try:
|
|
|
|
|
yield None
|
|
|
|
|
finally:
|
|
|
|
|
_resetWpilibSimulationData()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="function")
|
|
|
|
|
def nt(cfg_logging, wpilib_state):
|
|
|
|
|
instance = ntcore.NetworkTableInstance.getDefault()
|
|
|
|
|
instance.startLocal()
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
yield instance
|
|
|
|
|
finally:
|
|
|
|
|
instance.stopLocal()
|
|
|
|
|
instance._reset()
|