[tracker] functional-tests: Avoid AttributeError exception in Helper.stop()



commit 37f4b5e5588e95bc863e97a6b10cbe9b1973fcd4
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Oct 10 22:10:13 2015 +0200

    functional-tests: Avoid AttributeError exception in Helper.stop()
    
    If a process was never started, the .stop method should do nothing
    instead of raising an AttributeError.

 tests/functional-tests/common/utils/helpers.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index 556f11f..e0f51fa 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -63,6 +63,8 @@ class Helper:
         self.bus = None
         self.bus_admin = None
 
+        self.process = None
+
     def install_glib_excepthook(self, loop):
         """
         Handler to abort test if an exception occurs inside the GLib main loop.
@@ -177,6 +179,10 @@ class Helper:
         self.abort_if_process_exits_with_status_0 = False
 
     def stop (self):
+        if self.process is None:
+            # Seems that it didn't even start...
+            return
+
         start = time.time()
         if self.process.poll() == None:
             # It should step out of this loop when the miner disappear from the bus


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]