commit 9abf23f9fd2f8ef5b05e9c99b9213917439231ab Author: Hackerberry Finn hackerberry@fi.nn Date: Sat Nov 3 22:01:37 2012 -0700
Fix some things that are broken --- ooni/bridget/tests/echo.py | 2 +- ooni/nettest.py | 6 +++--- ooni/templates/httpt.py | 4 ++-- ooni/templates/scapyt.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/ooni/bridget/tests/echo.py b/ooni/bridget/tests/echo.py index a0826b6..7f3217a 100644 --- a/ooni/bridget/tests/echo.py +++ b/ooni/bridget/tests/echo.py @@ -20,7 +20,7 @@ from pprint import pprint from twisted.internet import reactor from twisted.plugin import IPlugin from twisted.python import usage -from ooni.nettest import TestCase +from ooni.nettest import NetTestCase from ooni.utils import log, Storage from ooni.utils.net import PermissionsError, IfaceError
diff --git a/ooni/nettest.py b/ooni/nettest.py index 4ec1ccb..542b777 100644 --- a/ooni/nettest.py +++ b/ooni/nettest.py @@ -73,8 +73,8 @@ class NetTestAdaptor(unittest.TestCase): @classmethod def __new__(cls, *args, **kwargs): super( NetTestAdaptor, cls ).__new__(*args, **kwargs) - if hasattr(cls, setUpClass): - setUpClass(cls) + if hasattr(cls, "setUpClass"): + super( NetTestAdaptor, cls ).setUpClass() else: log.debug("NetTestAdaptor: constructor could not find setUpClass")
@@ -184,7 +184,7 @@ class NetTestAdaptor(unittest.TestCase): return _copy(new=args[1], alt=args[2]) elif kwargs: return _copy(kwargs) - else: + else: return
@staticmethod diff --git a/ooni/templates/httpt.py b/ooni/templates/httpt.py index f453c74..acad538 100644 --- a/ooni/templates/httpt.py +++ b/ooni/templates/httpt.py @@ -13,7 +13,7 @@ from twisted.internet.ssl import ClientContextFactory
from twisted.web.http_headers import Headers
-from ooni.nettest import TestCase +from ooni.nettest import NetTestCase from ooni.utils import log
useragents = [("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6", "Firefox 2.0, Windows XP"), @@ -39,7 +39,7 @@ class BodyReceiver(protocol.Protocol): def connectionLost(self, reason): self.finished.callback(self.data)
-class HTTPTest(TestCase): +class HTTPTest(NetTestCase): """ A utility class for dealing with HTTP based testing. It provides methods to be overriden for dealing with HTTP based testing. diff --git a/ooni/templates/scapyt.py b/ooni/templates/scapyt.py index 77f2807..f71ab57 100644 --- a/ooni/templates/scapyt.py +++ b/ooni/templates/scapyt.py @@ -11,12 +11,12 @@ from twisted.internet import protocol, defer
from scapy.all import IP, TCP
-from ooni.nettest import TestCase +from ooni.nettest import NetTestCase from ooni.utils import log
from ooni.lib.txscapy import txsr, txsend
-class ScapyTest(TestCase): +class ScapyTest(NetTestCase): """ A utility class for writing scapy driven OONI tests.
tor-commits@lists.torproject.org