[tracker-miners/sam/test-runner-fix: 5/19] functional-tests: Fix logic error in await_resource_inserted() helper



commit f5790b1a499cea32f2d9a304a25a22aac45b1baf
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Nov 17 12:21:45 2018 +0100

    functional-tests: Fix logic error in await_resource_inserted() helper
    
    Each Helper instance only supports waiting for one resource at a time.
    As a safeguard it starts by asserting that its internal state is all
    unset. However, in some cases it would fail to clear the variables
    causing spurious assertion failures.

 tests/functional-tests/common/utils/helpers.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index 3ae7b674b..61f879e54 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -323,7 +323,7 @@ class StoreHelper (Helper):
         Block until a resource matching the parameters becomes available
         """
         assert (self.inserts_match_function == None)
-        assert (self.class_to_track == None)
+        assert (self.class_to_track == None), "Already waiting for resource of type %s" % self.class_to_track
 
         self.class_to_track = rdf_class
 
@@ -397,10 +397,9 @@ class StoreHelper (Helper):
                 self.loop.run_checked ()
             except GraphUpdateTimeoutException as e:
                 raise GraphUpdateTimeoutException("Timeout waiting for resource: class %s, URL %s, title %s" 
% (rdf_class, url, title))
-
             self.inserts_match_function = None
-            self.class_to_track = None
 
+        self.class_to_track = None
         return (self.matched_resource_id, self.matched_resource_urn)
 
     def await_resource_deleted (self, rdf_class, id):


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