Improve code and coverage

This commit is contained in:
Andrew Klychkov 2020-12-10 13:58:38 +03:00
parent 5c9e05b026
commit 8ff33bd729
2 changed files with 3 additions and 6 deletions

View file

@ -248,14 +248,11 @@ executed_queries = []
def uses_replica_terminology(cursor):
"""Checks if REPLICA must be used instead of SLAVE"""
cursor.execute("SELECT VERSION()")
cursor.execute("SELECT VERSION() AS version")
result = cursor.fetchone()
if isinstance(result, dict):
if 'VERSION()' in result:
version_str = result['VERSION()']
else:
version_str = result['version()']
version_str = result['version']
else:
version_str = result[0]

View file

@ -19,7 +19,7 @@ class dummy_cursor_class():
def fetchone(self):
if self.ret_val_type == 'dict':
return {'VERSION()': self.output}
return {'version': self.output}
elif self.ret_val_type == 'list':
return [self.output]