Skip to content
Snippets Groups Projects
Commit 0ca32f0f authored by Lucas Magalhães's avatar Lucas Magalhães
Browse files

Add tests for generated PVs

parent c9944227
No related branches found
No related tags found
1 merge request!139E3-1214: Fix usage of string functions
Pipeline #153296 passed
import re import re
import pytest
import os
from .utils import Wrapper, run_ioc_get_output from .utils import Wrapper, run_ioc_get_output
...@@ -53,3 +54,40 @@ def test_after_init(): ...@@ -53,3 +54,40 @@ def test_after_init():
lines = outs.split("\n") lines = outs.split("\n")
assert "hello" in lines[lines.index("iocInit") :] assert "hello" in lines[lines.index("iocInit") :]
@pytest.mark.parametrize(
"pv, expected",
[
("Modules", r"\"require\" *\"{name}\""),
("Versions", r"\"[0-9a-z.+-]+\" *\"{version}\""),
("ModuleVersions", r"require [0-9a-z.+-]+\\n{name} {version}\\n"),
("{name}Version", r"{version}"),
("requireVersion", r"[0-9a-z.+-]+"),
],
)
def test_require_pvs(wrapper: Wrapper, pv, expected):
cell_path = wrapper.path / "cellMods"
returncode, _, _ = wrapper.run_make(
"cellinstall",
cell_path=cell_path,
)
os.environ["IOCNAME"] = "TEST"
rc, stdout, _ = run_ioc_get_output(
"-l",
cell_path,
"-r",
wrapper.name,
"-c",
"afterInit dbgf TEST:" + pv.format(name=wrapper.name),
)
assert rc == 0
match = re.search(
expected.format(
name=wrapper.name,
version=wrapper.version.replace(".", "\\.").replace("+", "\\+"),
),
stdout,
)
assert match
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment