19 lines
665 B
Python
19 lines
665 B
Python
import pytest
|
|
|
|
from iiwa_genesis.runtime import plain_urdf_source
|
|
|
|
|
|
def test_adapter_disables_only_xacro_path():
|
|
source = "import xacro\ndef load_xacro(path, mappings):\n return xacro.process_file(path)\ndef load_plain():\n return 7\n"
|
|
namespace = {}
|
|
exec(plain_urdf_source(source, "test.py"), namespace)
|
|
assert namespace["load_plain"]() == 7
|
|
assert "xacro" not in namespace
|
|
with pytest.raises(RuntimeError, match="disabled"):
|
|
namespace["load_xacro"]("foo.xacro", {})
|
|
|
|
|
|
def test_adapter_rejects_changed_upstream():
|
|
with pytest.raises(RuntimeError, match="changed"):
|
|
plain_urdf_source("def load_plain(): pass", "test.py")
|