Skip to content

Commit

Permalink
Merge pull request #328 from KaushikMalapati/readonly
Browse files Browse the repository at this point in the history
DEV: Making _RBV PVs read-only
  • Loading branch information
KaushikMalapati committed Sep 16, 2024
2 parents 2c4f412 + e83b1ef commit c30a7c9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pytmc/templates/asyn_standard_record.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ record({{record.record_type}}, "{{record.pvname}}") {
info(archive, "{{ record.archive_settings['method'] }} {{ record.archive_settings['seconds'] }}: {{ record.archive_settings['fields'] | join(' ') }}")
{% endif %}
{% endif %}
{% if record.direction == "input" %}
field(ASG, "NO_WRITE")
{% endif %}
}
24 changes: 24 additions & 0 deletions pytmc/tests/test_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@ def test_epics_record_with_linter(dbd_file):
assert not (linted.errors)


def test_input_record_without_write_access():
kwargs = {
"pvname": "Tst:pv",
"record_type": "ai",
"direction": "input",
}

ec = EPICSRecord(**kwargs)
record = ec.render()
assert "ASG" in record
assert "NO_WRITE" in record


def test_output_record_with_write_access():
kwargs = {
"pvname": "Tst:pv",
"record_type": "ao",
"direction": "output",
}
ec = EPICSRecord(**kwargs)
record = ec.render()
assert "ASG" not in record


def test_sort_fields():
unsorted_entry = OrderedDict(
[
Expand Down

0 comments on commit c30a7c9

Please sign in to comment.