MCPcopy
hub / github.com/questdb/questdb / run_test

Function run_test

compat/src/test/python/runner_psycopg3.py:175–208  ·  view source on GitHub ↗
(test, global_variables, connection, binary)

Source from the content-addressed store, hash-verified

173
174
175def run_test(test, global_variables, connection, binary):
176 variables = global_variables.copy()
177 variables.update(test.get('variables', {}))
178
179 cursor = connection.cursor(binary=binary)
180
181 test_failed = False
182 try:
183 # Prepare phase
184 prepare_steps = test.get('prepare', [])
185 execute_steps(prepare_steps, variables, cursor, connection)
186
187 # Test steps
188 test_steps = test.get('steps', [])
189 execute_steps(test_steps, variables, cursor, connection)
190
191 print(f"Test '{test['name']}' passed.")
192
193 test_failed = False
194
195 except Exception as e:
196 print(f"Test '{test['name']}' failed: {str(e)}")
197 test_failed = True
198
199 finally:
200 # Teardown phase should run regardless of test outcome
201 teardown_steps = test.get('teardown', [])
202 try:
203 execute_steps(teardown_steps, variables, cursor, connection)
204 except Exception as teardown_exception:
205 print(f"Teardown for test '{test['name']}' failed: {str(teardown_exception)}")
206 cursor.close()
207 if test_failed:
208 sys.exit(1)
209
210
211def main(yaml_file):

Callers 1

mainFunction · 0.70

Calls 5

execute_stepsFunction · 0.70
copyMethod · 0.65
updateMethod · 0.65
getMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…