Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pyaml/accelerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
from .configuration.factory import Factory
from .control.controlsystem import ControlSystem
from .lattice.simulator import Simulator
from .validation import SchemaValidator
from .validation import DynamicValidation, SchemaValidator, register_schema
from .yellow_pages import YellowPages

# Define the main class name for this module
PYAMLCLASS = "Accelerator"


class Accelerator:
@register_schema
class Accelerator(DynamicValidation):
"""
Top-level accelerator object.

Expand Down
12 changes: 6 additions & 6 deletions tests/common/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
)
def test_tune(install_test_package):
with pytest.raises(PyAMLConfigException) as exc:
ml: Accelerator = Accelerator.load("tests/config/bad_conf_duplicate_1.yaml", include_locations=True, validate=True)
ml: Accelerator = Accelerator.load("tests/config/bad_conf_duplicate_1.yaml", include_locations=True, validate=False)
print(exc.value)
assert "MagnetArray HCORR : duplicate name SH1A-C02-H @index 2" in str(exc.value)

with pytest.raises(PyAMLConfigException) as exc:
ml: Accelerator = Accelerator.load("tests/config/bad_conf_duplicate_2.yaml", include_locations=True, validate=True)
ml: Accelerator = Accelerator.load("tests/config/bad_conf_duplicate_2.yaml", include_locations=True, validate=False)
assert "BPMArray BPM : duplicate name BPM_C04-06 @index 3" in str(exc.value)

with pytest.raises(PyAMLConfigException) as exc:
Expand All @@ -28,10 +28,10 @@ def test_tune(install_test_package):
assert "line 43, column 3" in str(exc.value)

with pytest.raises(PyAMLConfigException) as exc:
ml: Accelerator = Accelerator.load("tests/config/bad_conf_duplicate_4.yaml", include_locations=True, validate=True)
ml: Accelerator = Accelerator.load("tests/config/bad_conf_duplicate_4.yaml", include_locations=True, validate=False)
assert "MagnetArray HCORR : duplicate name SH1A-C02-H @index 2" in str(exc.value)

sr: Accelerator = Accelerator.load("tests/config/EBSTune.yaml", include_locations=True, validate=True)
sr: Accelerator = Accelerator.load("tests/config/EBSTune.yaml", include_locations=True, validate=False)
m1 = sr.live.magnet.get("QF1E-C04")
m2 = sr.design.magnet.get("QF1A-C05")
with pytest.raises(PyAMLException) as exc:
Expand Down Expand Up @@ -91,7 +91,7 @@ def test_malformed_local_included_yaml_reports_source_line_and_column(tmp_path):
)

with pytest.raises(PyAMLException) as exc:
Accelerator.load(str(root), include_locations=True, validate=True)
Accelerator.load(str(root), include_locations=True, validate=False)

message = str(exc.value)
assert str(broken_devices) in message
Expand All @@ -116,7 +116,7 @@ def test_truncated_local_included_json_reports_source_and_position(tmp_path):
)

with pytest.raises(PyAMLException) as exc:
Accelerator.load(str(root), include_locations=True, validate=True)
Accelerator.load(str(root), include_locations=True, validate=False)

message = str(exc.value)
assert str(broken_devices) in message
Expand Down
Loading