From 4a8edf44e649a167961c885f22700b7d3250ece9 Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Thu, 25 Feb 2016 14:55:29 +0100 Subject: [PATCH] Convert normal methods to static methods when possible. --- features/basic_replication.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/features/basic_replication.py b/features/basic_replication.py index 77351428..3a39b8b7 100644 --- a/features/basic_replication.py +++ b/features/basic_replication.py @@ -10,19 +10,23 @@ class BasicReplicationSteps(object): def __init__(self, environ): self.env = environ - def start_patroni(self, step, name): + @staticmethod + def start_patroni(step, name): '''I start (\w+)''' return world.pctl.start(name) - def stop_patroni(self, step, name): + @staticmethod + def stop_patroni(step, name): '''I shut down (\w+)''' return world.pctl.stop(name) - def kill_patroni(self, step, name): + @staticmethod + def kill_patroni(step, name): '''I kill (\w+)''' return world.pctl.stop(name, kill=True) - def add_table(self, step, table_name, pg_name): + @staticmethod + def add_table(step, table_name, pg_name): '''I add the table (\w+) to (\w+)''' # parse the configuration file and get the port try: @@ -30,7 +34,8 @@ class BasicReplicationSteps(object): except pg.Error as e: assert False, "Error creating table {0} on {1}: {2}".format(table_name, pg_name, e) - def table_is_present_on(self, step, table_name, pg_name, max_replication_delay): + @staticmethod + def table_is_present_on(step, table_name, pg_name, max_replication_delay): '''Table (\w+) is present on (\w+) after (\d+) seconds''' for i in range(int(max_replication_delay)): if world.pctl.query(pg_name, "SELECT 1 FROM {0}".format(table_name), fail_ok=True) is not None: @@ -40,7 +45,8 @@ class BasicReplicationSteps(object): assert False,\ "Table {0} is not present on {1} after {2} seconds".format(table_name, pg_name, max_replication_delay) - def check_role(self, step, pg_name, pg_role, max_promotion_timeout): + @staticmethod + def check_role(step, pg_name, pg_role, max_promotion_timeout): '''(\w+) role is the (\w+) after (\d+) seconds''' if not world.pctl.check_role_has_changed_to(pg_name, pg_role, timeout=int(max_promotion_timeout)): assert False, "{0} role didn't change to {1} after {2} seconds".format(pg_name, pg_role, max_promotion_timeout)