feat(right_arm): /home, /custom_pose, PUT /custom_pose, PUT /offset + fixture conftest
This commit is contained in:
1 parent
afbfd55bca
commit
59f7f66d77
3 files changed
+164
-1
No files matched your search
@@ -7,3 +7,29 @@ from pathlib import Path
|
||||
_SRC = Path(__file__).resolve().parent.parent / "src"
|
||||
if str(_SRC) not in sys.path:
|
||||
sys.path.insert(0, str(_SRC))
|
||||
|
||||
import pytest
|
||||
|
||||
_CFG_PATH = Path(__file__).resolve().parent.parent / "config.yaml"
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _restore_config_yaml():
|
||||
"""Snapshot/restore config.yaml + in-memory singleton.
|
||||
Any test that triggers update_config() would otherwise leave the file
|
||||
cosmetically reformatted (compact flow-style -> block-style) AND/OR
|
||||
semantically mutated. This fixture keeps the working tree clean."""
|
||||
if not _CFG_PATH.exists():
|
||||
yield
|
||||
return
|
||||
snapshot = _CFG_PATH.read_bytes()
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
_CFG_PATH.write_bytes(snapshot)
|
||||
# Reset in-memory singleton so subsequent tests re-read disk
|
||||
try:
|
||||
from presa_mano import config as _cfg_mod
|
||||
_cfg_mod._STATE["config"] = None # type: ignore[attr-defined]
|
||||
except Exception:
|
||||
pass # if internals change, we still get the disk reset
|
||||
Reference in new issue
Block a user