Add Wall-X serving and Turtle2 TCP WebSocket bridge
Pre-commit / pre-commit (push) Canceled after 0s
Pre-commit / pre-commit (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""Check that the launch command rejects a mismatched model action length."""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import pytest
|
||||
|
||||
|
||||
ROOT = Path(__file__).parents[1]
|
||||
SCRIPT = ROOT / "scripts" / "run_serving.sh"
|
||||
|
||||
|
||||
def _launch(horizon):
|
||||
if "WALLX_TEST_CHECKPOINT" not in os.environ:
|
||||
pytest.skip("set WALLX_TEST_CHECKPOINT to run checkpoint-specific contract tests")
|
||||
checkpoint = Path(os.environ["WALLX_TEST_CHECKPOINT"])
|
||||
env = os.environ.copy()
|
||||
env["PYTHON_BIN"] = os.environ.get("WALLX_TEST_PYTHON", "python")
|
||||
return subprocess.run(
|
||||
[
|
||||
"bash", str(SCRIPT),
|
||||
"--checkpoint-path", str(checkpoint),
|
||||
"--train-config-path", str(checkpoint / "config.yml"),
|
||||
"--action-horizon", str(horizon),
|
||||
"--dry-run",
|
||||
],
|
||||
cwd=ROOT, env=env, text=True, capture_output=True, check=False,
|
||||
)
|
||||
|
||||
|
||||
def test_launch_rejects_mismatch_to_training_horizon():
|
||||
result = _launch(10)
|
||||
assert result.returncode != 0
|
||||
assert "action horizon" in (result.stderr + result.stdout).lower()
|
||||
|
||||
|
||||
def test_launch_accepts_training_horizon():
|
||||
result = _launch(32)
|
||||
assert result.returncode == 0, result.stderr
|
||||
assert "--model-config.action-horizon 32" in result.stdout
|
||||
Reference in New Issue
Block a user