2 """script test to simulate a closed loop
5 check.py <parameters_filename> [options]
7 where parameters_filename is the path to the parameters file
10 -h --help Show this help message and exit
11 -d, --devices devices Specify the devices
12 --displayResult Just print the results of the check process
13 --repportResult=<repport.md> Save the results of the check process into a md_file
16 from docopt
import docopt
18 if __name__ ==
"__main__":
22 arguments = docopt(__doc__)
24 if arguments[
"--displayResult"]:
26 from tabulate
import tabulate
27 from datetime
import datetime
28 df = pandas.read_hdf(
"check.h5")
29 print(tabulate(df, tablefmt=
"pipe", headers=
"keys"))
30 if arguments[
"--repportResult"]:
31 with open(arguments[
"--repportResult"],
'w')
as the_file:
32 the_file.write(
'# E2E Test Report\n')
34 the_file.write(datetime.now().strftime(
35 '*Report generated on %d-%b-%Y %H:%M:%S by checkCompass.sh*\n'))
37 the_file.write(
'[Unit Tests report](report_unit_test.html)\n')
39 the_file.write(
'## Summary\n')
41 the_file.write(str(tabulate(df, tablefmt=
"pipe", headers=
"keys")))
45 param_file = arguments[
"<parameters_filename>"]
48 if arguments[
"--devices"]:
49 supervisor.config.p_loop.set_devices([
50 int(device)
for device
in arguments[
"--devices"].
split(
",")
54 is_init = supervisor.is_init
59 supervisor.loop(supervisor.config.p_loop.niter)
60 SR = supervisor.target.get_strehl(0)[1]
65 df = pandas.read_hdf(
"check.h5")
66 except FileNotFoundError:
67 columns = [
"Test name",
"Init",
"SR@100iter"]
68 df = pandas.DataFrame(columns=columns)
71 df.loc[idx,
"Test name"] = param_file.split(
'/')[-1]
72 df.loc[idx,
"Init"] = is_init
73 df.loc[idx,
"SR@100iter"] = SR
75 df.to_hdf(
"check.h5",
"check")