예제 #1
0
def test_TmcFile_fullbuild(string_tmc_path):
    tmc = TmcFile(string_tmc_path)
    tmc.create_chains()
    tmc.isolate_chains()
    tmc.create_packages()
    tmc.configure_packages()
    z = tmc.render()
    print(z)
예제 #2
0
def test_TmcFile_render(generic_tmc_path):
    tmc = TmcFile(None)
    brp1 = BaseRecordPackage(851)
    brp1.cfg.add_config_line('pv', 'example_pv')
    brp1.cfg.add_config_line('type', 'ao')
    brp1.cfg.add_config_field("DTYP", '"MyDTYP"')
    brp1.cfg.add_config_field("PINI", '"VX"')
    brp1.cfg.add_config_field("NELM", 3)
    brp1.cfg.add_config_field('ABC', '"test 0"')
    brp2 = BaseRecordPackage(851)
    brp2.cfg.add_config_line('pv', 'example_pv2')
    brp2.cfg.add_config_line('type', 'bi')
    brp2.cfg.add_config_field("DTYP", '"MyDTYP"')
    brp2.cfg.add_config_field("PINI", '"1"')
    brp2.cfg.add_config_field("NELM", 2)
    brp2.cfg.add_config_field('ABC', '"test k"')

    tmc.all_RecordPackages.append(brp1)
    tmc.all_RecordPackages.append(brp2)

    target_response = """\
    record(ao,"example_pv"){
      field(DTYP, "MyDTYP")
      field(PINI, "VX")
      field(NELM, 3)
      field(ABC, "test 0")
    }

    record(bi,"example_pv2"){
      field(DTYP, "MyDTYP")
      field(PINI, "1")
      field(NELM, 2)
      field(ABC, "test k")
    }

    """
    target_response = textwrap.dedent(target_response)
    assert target_response == tmc.render()