Appease Quantifiedcode about stylistic issues

This commit is contained in:
Ants Aasma
2016-08-30 00:40:19 +03:00
parent e428c8d0fa
commit fa6bd51ad1
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -33,7 +33,7 @@ def slot_name_from_member_name(member_name):
def replace_char(match):
c = match.group(0)
return '_' if c in '-.' else "u%04d" % ord(c)
return '_' if c in '-.' else "u{:04d}".format(ord(c))
slot_name = re.sub('[^a-z0-9_]', replace_char, member_name.lower())
return slot_name[0:64]
@@ -922,7 +922,7 @@ $$""".format(name, ' '.join(options)), name, password, password)
for name in slot_members:
slot_conflicts[slot_name_from_member_name(name)].append(name)
logger.error("Following cluster members share a replication slot name: %s",
"; ".join("%s map to %s" % (", ".join(v), k)
"; ".join("{} map to {}".format(", ".join(v), k)
for k, v in slot_conflicts.items() if len(v) > 1))
# drop unused slots
+2 -1
View File
@@ -327,7 +327,8 @@ class TestPostgresql(unittest.TestCase):
cluster.members.extend([alias1, alias2])
self.p.sync_replication_slots(cluster)
errorlog_mock.assert_called_once()
assert "test-3" in errorlog_mock.call_args[0][1] and "test.3" in errorlog_mock.call_args[0][1]
assert "test-3" in errorlog_mock.call_args[0][1]
assert "test.3" in errorlog_mock.call_args[0][1]
@patch.object(MockConnect, 'closed', 2)
def test__query(self):