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

[tor-commits] [ooni-probe/master] Fix import inside of nettest



commit 649aa4710ee6b180310f4636f41b2561ed6df47e
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Sat Jan 12 18:47:09 2013 +0100

    Fix import inside of nettest
---
 ooni/nettest.py |   24 +++++++-----------------
 1 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/ooni/nettest.py b/ooni/nettest.py
index 054da9e..ecf7765 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -1,24 +1,13 @@
-import itertools
-import traceback
-import sys
 import os
 
-from twisted.trial import unittest, itrial, util
-from twisted.internet import defer, utils
-from twisted.python import usage
+from twisted.trial.runner import filenameToModule
+from twisted.python import usage, reflect
 
-from ooni.errors import handleAllFailures, failureToString
+from ooni.tasks import Measurement
 from ooni.utils import log
 
-from .tasks import TaskWithTimeout
 from inspect import getmembers
-from ooni.nettest import NetTestCase
-from ooni.ratelimiting import StaticRateLimiter
-from twisted.python.reflect import prefixedMethodNames
-from twisted.trial.runner import filenameToModule
 from StringIO import StringIO
-from os.path import isfile
-
 
 class NetTest(object):
     director = None
@@ -39,6 +28,8 @@ class NetTest(object):
         self.inputs = inputs
         self.options = options
 
+        self.report = report
+
     def loadNetTest(self, net_test_object):
         """
         Creates all the necessary test_cases (a list of tuples containing the
@@ -60,7 +51,7 @@ class NetTest(object):
             is a file like object that will be used to generate the test_cases.
         """
         try:
-            if isfile(net_test_object):
+            if os.path.isfile(net_test_object):
                 return self._loadNetTestFile(net_test_object)
         except TypeError:
             if isinstance(net_test_object, StringIO) or \
@@ -95,7 +86,7 @@ class NetTest(object):
         test_cases = []
         try:
             assert issubclass(item, NetTestCase)
-            methods = prefixedMethodNames(item, self.method_prefix)
+            methods = reflect.prefixedMethodNames(item, self.method_prefix)
             for method in methods:
                 test_cases.append((item, self.method_prefix + method))
         except (TypeError, AssertionError):
@@ -117,7 +108,6 @@ class NetTest(object):
             for test_class, test_method in self.test_cases:
                 measurement = Measurement(test_class, test_method, test_input)
                 measurement.netTest = self
-                measurement.timeout = self.rateLimiter.timeout
                 yield measurement
 
 class NoPostProcessor(Exception):



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