testium-hil 0.4.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. testium/__init__.py +149 -0
  2. testium/__main__.py +20 -0
  3. testium/api/__init__.py +0 -0
  4. testium/api/console.py +753 -0
  5. testium/api/console_ssh.py +581 -0
  6. testium/api/raw_tcp_console.py +80 -0
  7. testium/api/runtime_plot.py +381 -0
  8. testium/api/termconsole.py +156 -0
  9. testium/api/testium.py +325 -0
  10. testium/interpreter/__init__.py +0 -0
  11. testium/interpreter/batch.py +124 -0
  12. testium/interpreter/process.py +506 -0
  13. testium/interpreter/test_items/__init__.py +0 -0
  14. testium/interpreter/test_items/dialog_choices_files/__init__.py +0 -0
  15. testium/interpreter/test_items/dialog_choices_files/choices_dialog.py +264 -0
  16. testium/interpreter/test_items/dialog_choices_files/choices_dialog_win.py +66 -0
  17. testium/interpreter/test_items/dialog_env.py +17 -0
  18. testium/interpreter/test_items/dialog_image_files/__init__.py +0 -0
  19. testium/interpreter/test_items/dialog_image_files/dialog_image.py +77 -0
  20. testium/interpreter/test_items/dialog_image_files/dialog_image_win.py +59 -0
  21. testium/interpreter/test_items/dialog_msg_files/__init__.py +0 -0
  22. testium/interpreter/test_items/dialog_msg_files/msg_dialog.py +39 -0
  23. testium/interpreter/test_items/dialog_note_files/__init__.py +0 -0
  24. testium/interpreter/test_items/dialog_note_files/dialog_note_win.py +64 -0
  25. testium/interpreter/test_items/dialog_note_files/test_dialog.py +64 -0
  26. testium/interpreter/test_items/dialog_question_files/__init__.py +0 -0
  27. testium/interpreter/test_items/dialog_question_files/question_dialog.py +43 -0
  28. testium/interpreter/test_items/dialog_sleep_files/__init__.py +0 -0
  29. testium/interpreter/test_items/dialog_sleep_files/dialog_sleep.py +83 -0
  30. testium/interpreter/test_items/dialog_sleep_files/dialog_sleep_win.py +121 -0
  31. testium/interpreter/test_items/dialog_value_files/__init__.py +0 -0
  32. testium/interpreter/test_items/dialog_value_files/dialog_value_win.py +56 -0
  33. testium/interpreter/test_items/dialog_value_files/test_dialog.py +69 -0
  34. testium/interpreter/test_items/item_actions/__init__.py +151 -0
  35. testium/interpreter/test_items/item_actions/action.py +45 -0
  36. testium/interpreter/test_items/test_item.py +645 -0
  37. testium/interpreter/test_items/test_item_check.py +62 -0
  38. testium/interpreter/test_items/test_item_choices_dialog.py +106 -0
  39. testium/interpreter/test_items/test_item_console.py +501 -0
  40. testium/interpreter/test_items/test_item_container.py +37 -0
  41. testium/interpreter/test_items/test_item_cycle.py +309 -0
  42. testium/interpreter/test_items/test_item_dialog_base.py +58 -0
  43. testium/interpreter/test_items/test_item_git.py +46 -0
  44. testium/interpreter/test_items/test_item_group.py +84 -0
  45. testium/interpreter/test_items/test_item_image_dialog.py +68 -0
  46. testium/interpreter/test_items/test_item_json_rpc/__init__.py +353 -0
  47. testium/interpreter/test_items/test_item_json_rpc/jsonrpc_adapters.py +482 -0
  48. testium/interpreter/test_items/test_item_let.py +54 -0
  49. testium/interpreter/test_items/test_item_lua_func.py +138 -0
  50. testium/interpreter/test_items/test_item_msg_dialog.py +56 -0
  51. testium/interpreter/test_items/test_item_note_dialog.py +87 -0
  52. testium/interpreter/test_items/test_item_parallel.py +225 -0
  53. testium/interpreter/test_items/test_item_py_func.py +156 -0
  54. testium/interpreter/test_items/test_item_pytest.py +408 -0
  55. testium/interpreter/test_items/test_item_question_dialog.py +67 -0
  56. testium/interpreter/test_items/test_item_report.py +57 -0
  57. testium/interpreter/test_items/test_item_run.py +209 -0
  58. testium/interpreter/test_items/test_item_runtime_plot.py +283 -0
  59. testium/interpreter/test_items/test_item_sleep.py +96 -0
  60. testium/interpreter/test_items/test_item_tested_references.py +91 -0
  61. testium/interpreter/test_items/test_item_unittest.py +239 -0
  62. testium/interpreter/test_items/test_item_value_dialog.py +88 -0
  63. testium/interpreter/test_items/test_result.py +83 -0
  64. testium/interpreter/test_items/tested_references_files/__init__.py +0 -0
  65. testium/interpreter/test_items/tested_references_files/tested_refs_dialog.py +109 -0
  66. testium/interpreter/test_items/tested_references_files/tested_refs_win.py +79 -0
  67. testium/interpreter/test_report/__init__.py +0 -0
  68. testium/interpreter/test_report/report_export_html.py +82 -0
  69. testium/interpreter/test_report/report_export_json.py +18 -0
  70. testium/interpreter/test_report/report_export_junit.py +39 -0
  71. testium/interpreter/test_report/report_export_txt.py +111 -0
  72. testium/interpreter/test_report/report_interface.py +7 -0
  73. testium/interpreter/test_report/test_report.py +568 -0
  74. testium/interpreter/test_set.py +704 -0
  75. testium/interpreter/utils/__init__.py +13 -0
  76. testium/interpreter/utils/api_srv.py +27 -0
  77. testium/interpreter/utils/bins.py +426 -0
  78. testium/interpreter/utils/constants.py +142 -0
  79. testium/interpreter/utils/eval.py +103 -0
  80. testium/interpreter/utils/globdict.py +79 -0
  81. testium/interpreter/utils/icons.py +12 -0
  82. testium/interpreter/utils/include.py +106 -0
  83. testium/interpreter/utils/lua_func_exec.py +48 -0
  84. testium/interpreter/utils/lua_process.py +185 -0
  85. testium/interpreter/utils/modules.py +12 -0
  86. testium/interpreter/utils/param_decl.py +194 -0
  87. testium/interpreter/utils/params.py +472 -0
  88. testium/interpreter/utils/paths.py +67 -0
  89. testium/interpreter/utils/periodic_timer.py +32 -0
  90. testium/interpreter/utils/proc_drain.py +106 -0
  91. testium/interpreter/utils/py_eval.py +54 -0
  92. testium/interpreter/utils/py_func_exec.py +57 -0
  93. testium/interpreter/utils/py_process.py +157 -0
  94. testium/interpreter/utils/settings.py +174 -0
  95. testium/interpreter/utils/step_ctrl.py +93 -0
  96. testium/interpreter/utils/template.py +92 -0
  97. testium/interpreter/utils/termlog.py +206 -0
  98. testium/interpreter/utils/test_ctrl.py +56 -0
  99. testium/interpreter/utils/test_init.py +312 -0
  100. testium/interpreter/utils/version.py +226 -0
  101. testium/interpreter/utils/yaml_load.py +37 -0
  102. testium/lsp/__init__.py +16 -0
  103. testium/lsp/__main__.py +6 -0
  104. testium/lsp/schema.py +202 -0
  105. testium/lsp/server.py +354 -0
  106. testium/lua_func/__init__.py +0 -0
  107. testium/lua_func/handle.lua +91 -0
  108. testium/lua_func/json-rpc.lua +132 -0
  109. testium/lua_func/main.lua +108 -0
  110. testium/lua_func/tm.lua +29 -0
  111. testium/lua_func/utils.lua +71 -0
  112. testium/main_win/__init__.py +0 -0
  113. testium/main_win/about_win/__init__.py +0 -0
  114. testium/main_win/about_win/about_win.py +84 -0
  115. testium/main_win/desktop_integration.py +95 -0
  116. testium/main_win/f1_win/__init__.py +0 -0
  117. testium/main_win/f1_win/d_f1_win.py +315 -0
  118. testium/main_win/f1_win/f1_win_core.py +184 -0
  119. testium/main_win/file_dialog.py +21 -0
  120. testium/main_win/preference_win/__init__.py +0 -0
  121. testium/main_win/preference_win/preference_core_win.py +394 -0
  122. testium/main_win/preference_win/preference_win.py +116 -0
  123. testium/main_win/resources/about_win_rc.py +1838 -0
  124. testium/main_win/resources/f1_win_rc.py +1844 -0
  125. testium/main_win/resources/testium_core_win_rc.py +17830 -0
  126. testium/main_win/test_controller_service.py +93 -0
  127. testium/main_win/test_file_manager.py +294 -0
  128. testium/main_win/test_run/__init__.py +0 -0
  129. testium/main_win/test_run/outlog.py +41 -0
  130. testium/main_win/test_run/test_run.py +46 -0
  131. testium/main_win/test_run/thread_output.py +28 -0
  132. testium/main_win/test_runner.py +298 -0
  133. testium/main_win/test_tree.py +498 -0
  134. testium/main_win/test_tree_items/__init__.py +0 -0
  135. testium/main_win/test_tree_items/common.py +19 -0
  136. testium/main_win/test_tree_items/test_tree_item.py +299 -0
  137. testium/main_win/testium_core_win.py +576 -0
  138. testium/main_win/testium_win.py +995 -0
  139. testium/main_win/text_log.py +75 -0
  140. testium/main_win/text_log_highlighter.py +172 -0
  141. testium/py_func/__init__.py +59 -0
  142. testium/py_func/__main__.py +27 -0
  143. testium/py_func/func_call.py +120 -0
  144. testium/py_func/handle.py +117 -0
  145. testium/py_func/tm.py +150 -0
  146. testium/runtime/__init__.py +5 -0
  147. testium/runtime/api.py +15 -0
  148. testium/runtime/export_worker.py +67 -0
  149. testium/runtime/jrpc.py +530 -0
  150. testium/runtime/stdout_redirect.py +145 -0
  151. testium/runtime/string_queue.py +57 -0
  152. testium/runtime/testium_report.py +197 -0
  153. testium/runtime/tum_except.py +109 -0
  154. testium_hil-0.4.2.dist-info/METADATA +45 -0
  155. testium_hil-0.4.2.dist-info/RECORD +159 -0
  156. testium_hil-0.4.2.dist-info/WHEEL +5 -0
  157. testium_hil-0.4.2.dist-info/entry_points.txt +2 -0
  158. testium_hil-0.4.2.dist-info/top_level.txt +2 -0
  159. testium_report.py +8 -0
testium/__init__.py ADDED
@@ -0,0 +1,149 @@
1
+ #!/usr/bin/env python
2
+ import sys
3
+ import os
4
+ import multiprocessing
5
+ from pathlib import Path
6
+
7
+ ourpath = Path(__file__)
8
+ ourpath = ourpath.resolve()
9
+ sys.path.append(os.path.abspath(ourpath.parent))
10
+
11
+ import interpreter.utils.constants as cst
12
+
13
+ def main():
14
+ # Force UTF-8 on stdout/stderr so the runner's output survives a legacy
15
+ # console code page (Windows cp1252 can't encode box-drawing/accented
16
+ # chars). Only the stream encoders change; the locale default used for
17
+ # config files is untouched.
18
+ for _stream in (sys.stdout, sys.stderr):
19
+ try:
20
+ _stream.reconfigure(encoding="utf-8")
21
+ except (AttributeError, ValueError):
22
+ pass # no stdout (frozen GUI) or non-reconfigurable stream
23
+
24
+ # Subcommand dispatch (must run *before* argparse so neither 'schema' nor
25
+ # 'lsp' has to share the GUI/batch flag surface). The subcommands also
26
+ # skip the multiprocessing 'spawn' setup which is only meaningful for the
27
+ # main runtime — schema is a pure stdout dump and lsp speaks JSON-RPC
28
+ # over stdio without ever forking a test process.
29
+ if len(sys.argv) >= 2 and sys.argv[1] in ("schema", "lsp"):
30
+ sub = sys.argv[1]
31
+ if sub == "schema":
32
+ from lsp.schema import dump_jsonschema_json
33
+ print(dump_jsonschema_json())
34
+ return
35
+ # lsp
36
+ try:
37
+ from lsp.server import serve
38
+ except ImportError as e:
39
+ print(
40
+ f"testium lsp: language server dependencies missing ({e.name}). "
41
+ "Install with: pip install 'testium[lsp]'",
42
+ file=sys.stderr,
43
+ )
44
+ sys.exit(2)
45
+ serve()
46
+ return
47
+
48
+ # This line sets the method for the "Process" function. It is required for Linux
49
+ # support of the test dialogs.
50
+ multiprocessing.set_start_method('spawn')
51
+
52
+ import argparse
53
+ parser = argparse.ArgumentParser()
54
+ parser.add_argument("--version",
55
+ help="Returns the version of testium", action='store_true')
56
+ parser.add_argument("-b", "--batch-execution",
57
+ help="Executes the test in batch mode", action='store_true')
58
+ parser.add_argument("-o", "--no-color",
59
+ help="Deactivates stdout colors in batch mode", action='store_true')
60
+ parser.add_argument("-c", "--config-file", help="Configuration file",
61
+ nargs='+',
62
+ default=[])
63
+ parser.add_argument("-r", "--run-and-close", action='store_true',
64
+ help="Runs the test then closes the application",
65
+ required=False)
66
+ parser.add_argument("-l", "--log-file", help="log file name", default='')
67
+ parser.add_argument("-d", "--define",
68
+ help="Configuration passed to the executed tests.",
69
+ nargs='+',
70
+ type=str,
71
+ action='append',
72
+ default=[])
73
+ parser.add_argument("-p", "--report-file",
74
+ help="report file name", default='')
75
+ parser.add_argument("-t", "--report-type", help="report file type",
76
+ choices=cst.REP_TYPES,
77
+ default='')
78
+ parser.add_argument("-n", "--report-pattern", help="report file pattern",
79
+ nargs='+',
80
+ default=[])
81
+ parser.add_argument("-i", "--include-path",
82
+ help="Python modules search path",
83
+ nargs='+',
84
+ default=[])
85
+ parser.add_argument("-g", "--dev-debug", "--debug", action='store_true',
86
+ dest="debug",
87
+ help="attach a debugger to testium itself "
88
+ "(development, see CONTRIBUTING.md)",
89
+ required=False)
90
+
91
+ parser.add_argument(
92
+ 'test_file', help='the test script file', nargs='?', default='')
93
+ args = parser.parse_args()
94
+
95
+ if len(args.include_path)>0:
96
+ for p in args.include_path:
97
+ sys.path.append(p)
98
+
99
+ defines = {}
100
+ defs = []
101
+ for define in args.define:
102
+ defs += define
103
+ for define in defs:
104
+ d = define.split('=', 1)
105
+ if d[0].strip() != '':
106
+ if len(d) > 1:
107
+ defines.update({d[0].strip(): d[1]})
108
+ else:
109
+ defines.update({d[0].strip(): True})
110
+
111
+ cf = []
112
+ for c in args.config_file:
113
+ conf = c.strip('\"').strip("\'")
114
+ if not os.path.isabs(conf):
115
+ conf = os.path.join(os.getcwd(), conf)
116
+ cf.append(conf)
117
+ tf = args.test_file.strip('\"').strip("\'")
118
+ rf = args.report_file.strip('\"').strip("\'")
119
+ lf = args.log_file.strip('\"').strip("\'")
120
+ pn = []
121
+ for p in args.report_pattern:
122
+ pn.append(p.strip('\"').strip("\'"))
123
+
124
+ if args.version:
125
+ # initilization of the settings (used to know if git supported)
126
+ import interpreter.utils.settings as prefs
127
+ prefs.init()
128
+
129
+ from interpreter.utils.version import get_testium_version
130
+ print(get_testium_version())
131
+
132
+ elif args.batch_execution:
133
+ if (lf != ''):
134
+ print('"-l" option is not supported in this mode.')
135
+
136
+ from interpreter.batch import Batch
137
+ b = Batch(tf, cf, defines, rf, args.report_type, pn, args.no_color, text_mode=True)
138
+ sys.exit(0 if b.success else 1)
139
+
140
+ else:
141
+ from main_win.testium_win import MainWin
142
+ MainWin(tf, config_files=cf,
143
+ run=args.run_and_close,
144
+ log_file=lf,
145
+ defines=defines,
146
+ report=rf,
147
+ report_type=args.report_type,
148
+ report_pattern=pn,
149
+ debug=args.debug)
testium/__main__.py ADDED
@@ -0,0 +1,20 @@
1
+ import os, sys
2
+ import traceback
3
+ import multiprocessing
4
+
5
+ def exception_handler(typ_exc, value, trbk):
6
+ """Testium Exception handling"""
7
+ print(f"Critical failure : '{value}'.")
8
+ tb = traceback.format_exception(typ_exc, value, trbk)
9
+ print("".join(tb[-4:]))
10
+
11
+ sys.excepthook = exception_handler
12
+
13
+ sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
14
+
15
+ from testium import main
16
+
17
+ if __name__ == '__main__':
18
+ if getattr(sys, 'frozen', False):
19
+ multiprocessing.freeze_support()
20
+ main()
File without changes