File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed
Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 3030 - name : Test
3131 run : |
3232 pytest tests -v
33- - name : Examples
33+ - name : Examples (internal)
3434 run : |
3535 python examples/fodo.py
36+ - name : Examples (external)
37+ run : |
38+ # Copy examples directory from the main PALS repository
39+ cd examples
40+ git clone --no-checkout https://github.com/pals-project/pals.git pals_temp
41+ cd pals_temp
42+ git sparse-checkout init
43+ git sparse-checkout set examples/
44+ git checkout main
45+ # Test all external examples
46+ cd -
47+ for file in pals_temp/examples/*.pals.yaml; do
48+ python test_external_examples.py --path "${file}"
49+ done
Original file line number Diff line number Diff line change 1+ # ruff: noqa: F841
2+
3+ import argparse
4+ import yaml
5+
6+ from pals import BeamLine
7+
8+
9+ def main ():
10+ # Parse command-line arguments
11+ parser = argparse .ArgumentParser ()
12+ parser .add_argument (
13+ "--path" ,
14+ required = True ,
15+ help = "Path to the example file" ,
16+ )
17+ args = parser .parse_args ()
18+ example_file = args .path
19+ # Read YAML data from file
20+ with open (example_file , "r" ) as file :
21+ data = yaml .safe_load (file )
22+ # Parse and validate YAML data
23+ print (f"Parsing data from { example_file } ..." )
24+ beamline = BeamLine (** data )
25+
26+
27+ if __name__ == "__main__" :
28+ main ()
You can’t perform that action at this time.
0 commit comments