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

art at torproject.org art at torproject.org
Sun Jan 5 23:22:59 UTC 2014


commit bff27aba551e64d429ef552fd0559ac859c5302c
Author: Arturo Filastò <art at fuffa.org>
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)





More information about the tor-commits mailing list