mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Project import generated by Copybara. GitOrigin-RevId: f10284b37498bb6a088891ca41f160793ec7fd90
34 lines
622 B
Python
34 lines
622 B
Python
import logging
|
|
|
|
import pytest
|
|
import ntcore
|
|
import wpilib
|
|
from wpilib.simulation._simulation import _resetWpilibSimulationData
|
|
|
|
pytest_plugins = "pytester"
|
|
|
|
|
|
@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()
|