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

[tor-commits] [ooni-probe/master] Create a new class instance per test method



commit bff27aba551e64d429ef552fd0559ac859c5302c
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Mon Jan 6 00:21:36 2014 +0100

    Create a new class instance per test method
    
    * This makes sure the class attributes are not shared across test methods
---
 ooni/nettest.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ooni/nettest.py b/ooni/nettest.py
index 7e1ef04..a1a46d6 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -557,9 +557,9 @@ class NetTest(object):
         for test_class, test_methods in self.testCases:
             # load the input processor as late as possible
             for input in test_class.inputs:
-                klass = test_class()
                 measurements = []
                 for method in test_methods:
+                    klass = test_class()
                     log.debug("Running %s %s" % (test_class, method))
                     measurement = self.makeMeasurement(klass, method, input)
                     measurements.append(measurement.done)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits