diff --git a/tests/sleeptest/sleeptest.py b/tests/sleeptest/sleeptest.py index 4c035866dd5b0f4fc93fb0379862ac4861cc7cee..bbaae8348f333e6ea7069f776419da1510397044 100755 --- a/tests/sleeptest/sleeptest.py +++ b/tests/sleeptest/sleeptest.py @@ -27,13 +27,18 @@ class sleeptest(test.Test): Example test for avocado. """ + def setup(self): + """ + If no config was provided, give self.params.sleep_length a default. + """ + self.params.set_default('sleep_length', 1.0) + def action(self): """ Sleep for length seconds. """ - length = self.params.get('sleep_length', 1.0) - self.log.debug("Sleeping for %.2f seconds", length) - time.sleep(length) + self.log.debug("Sleeping for %.2f seconds", self.params.sleep_length) + time.sleep(self.params.sleep_length) if __name__ == "__main__":