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

Function run_test

compat/src/test/python/runner_psycopg2.py:98–131  ·  view source on GitHub ↗
(test, global_variables, connection)

Source from the content-addressed store, hash-verified

96
97
98def run_test(test, global_variables, connection):
99 variables = global_variables.copy()
100 variables.update(test.get('variables', {}))
101
102 cursor = connection.cursor()
103
104 try:
105 # Prepare phase
106 prepare_steps = test.get('prepare', [])
107 execute_steps(prepare_steps, variables, cursor, connection)
108
109 # Test steps
110 test_steps = test.get('steps', [])
111 execute_steps(test_steps, variables, cursor, connection)
112
113 print(f"Test '{test['name']}' passed.")
114
115 test_failed = False
116
117 except Exception as e:
118 print(f"Test '{test['name']}' failed: {str(e)}")
119 test_failed = True
120
121 finally:
122 # Teardown phase should run regardless of test outcome
123 teardown_steps = test.get('teardown', [])
124 try:
125 execute_steps(teardown_steps, variables, cursor, connection)
126 except Exception as teardown_exception:
127 print(f"Teardown for test '{test['name']}' failed: {str(teardown_exception)}")
128 # Optionally handle teardown exceptions (e.g., logging)
129 cursor.close()
130 if test_failed:
131 sys.exit(1)
132
133
134def 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…