| 132 | |
| 133 | |
| 134 | def main(yaml_file): |
| 135 | data = load_yaml(yaml_file) |
| 136 | global_variables = data.get('variables', {}) |
| 137 | tests = data.get('tests', []) |
| 138 | |
| 139 | port = int(os.getenv('PGPORT', 8812)) |
| 140 | for test in tests: |
| 141 | iterations = test.get('iterations', 50) |
| 142 | exclusions = test.get('exclude', []) |
| 143 | if 'psycopg2' in exclusions: |
| 144 | print(f"Skipping test '{test['name']}' because it is excluded for psycopg2.") |
| 145 | continue |
| 146 | for i in range(iterations): |
| 147 | print(f"Running test '{test['name']}' iteration {i + 1}...") |
| 148 | connection = psycopg2.connect( |
| 149 | host='localhost', |
| 150 | port=port, |
| 151 | user='admin', |
| 152 | password='quest', |
| 153 | database='qdb' |
| 154 | ) |
| 155 | run_test(test, global_variables, connection) |
| 156 | connection.close() |
| 157 | |
| 158 | |
| 159 | if __name__ == '__main__': |