[tor-commits] [ooni-probe/master] * Changing all of the references to TestCase which referenced

isis at torproject.org isis at torproject.org
Sun Nov 4 13:50:41 UTC 2012


commit 27d3cd826f7277ba3481e98aa013e3039d52e5b3
Author: Isis Lovecruft <isis at torproject.org>
Date:   Sun Nov 4 04:44:28 2012 +0000

    * Changing all of the references to TestCase which referenced
      ooni.nettest.TestCase to "NetTestCase" because the class has been
      renamed. There other two things called "TestCase" are
      twisted.trial.unittest.TestCase and the Python Standard Library
      unittest.TestCase.
---
 nettests/core/captiveportal.py   |    2 +-
 nettests/core/dnstamper.py       |    2 +-
 nettests/simpletest.py           |    2 +-
 nettests/third_party/netalyzr.py |    2 +-
 ooni/inputunit.py                |    7 ++++---
 ooni/nettest.py                  |   11 +++++------
 ooni/utils/legacy.py             |    2 +-
 ooni/utils/meta.py               |   14 +++++++-------
 8 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/nettests/core/captiveportal.py b/nettests/core/captiveportal.py
index 77ba3e4..fdc37a0 100644
--- a/nettests/core/captiveportal.py
+++ b/nettests/core/captiveportal.py
@@ -57,7 +57,7 @@ optParameters = [['asset', 'a', None, 'Asset file'],
                   'User agent for HTTP requests']
                 ]
 
-class CaptivePortal(nettest.TestCase):
+class CaptivePortal(nettest.NetTestCase):
     """
     Compares content and status codes of HTTP responses, and attempts
     to determine if content has been altered.
diff --git a/nettests/core/dnstamper.py b/nettests/core/dnstamper.py
index aad2ef3..2018575 100644
--- a/nettests/core/dnstamper.py
+++ b/nettests/core/dnstamper.py
@@ -21,7 +21,7 @@ from twisted.internet import defer
 from twisted.names import client
 from twisted.names.error import DNSQueryRefusedError
 
-class DNSTamperTest(nettest.TestCase):
+class DNSTamperTest(nettest.NetTestCase):
 
     name = "DNS tamper"
     description = "DNS censorship detection test"
diff --git a/nettests/simpletest.py b/nettests/simpletest.py
index c599d68..a83b8ce 100644
--- a/nettests/simpletest.py
+++ b/nettests/simpletest.py
@@ -1,5 +1,5 @@
 from ooni import nettest
-class SimpleTest(nettest.TestCase):
+class SimpleTest(nettest.NetTestCase):
     inputs = range(1,100)
     optParameters = [['asset', 'a', None, 'Asset file'],
                      ['controlserver', 'c', 'google.com', 'Specify the control server'],
diff --git a/nettests/third_party/netalyzr.py b/nettests/third_party/netalyzr.py
index d73c245..20830ba 100644
--- a/nettests/third_party/netalyzr.py
+++ b/nettests/third_party/netalyzr.py
@@ -11,7 +11,7 @@ from ooni.utils import log
 import time
 import os
 
-class NetalyzrWrapperTest(nettest.TestCase):
+class NetalyzrWrapperTest(nettest.NetTestCase):
     name = "NetalyzrWrapper"
 
     def setUp(self):
diff --git a/ooni/inputunit.py b/ooni/inputunit.py
index ab46515..054b3a9 100644
--- a/ooni/inputunit.py
+++ b/ooni/inputunit.py
@@ -111,7 +111,7 @@ class InputUnitProcessor(InputUnit):
     """
     Create a generator for returning inputs one-by-one from a
     :class:`InputUnit` (or any other iterable defined within an instance of
-    :class:`ooni.nettest.TestCase`), and a generator function.
+    :class:`ooni.nettest.NetTestCase`), and a generator function.
 
     The :ivar:generator can be a custom generator, or chain of generators, for
     customized parsing of an InputUnit, or it can be an imported
@@ -129,7 +129,8 @@ class InputUnitProcessor(InputUnit):
     If :ivar:catchStopIter is False (default), then we catch the StopIteration
     exception, mark :attr:`empty` as 'True', and reraise the StopIteration.
 
-    xxx fill me in with parameter details
+    XXX fill me in with parameter details
+    XXX I'm not sure if we need this class anymore
     """
     empty = False
 
@@ -137,7 +138,7 @@ class InputUnitProcessor(InputUnit):
         """
         Create an InputUnitProcessor.
 
-        xxx fill me in
+        XXX fill me in
         """
         from itertools import takewhile
         from types     import GeneratorType
diff --git a/ooni/nettest.py b/ooni/nettest.py
index 8cd3c07..4ec1ccb 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -193,14 +193,13 @@ class NetTestAdaptor(unittest.TestCase):
     @classmethod
     def setUpClass(cls):
         """
-        Create a TestCase instance. This function is equivalent to '__init__'.
-        To add futher setup steps before a set of tests in a TestCase instance
-        run, create a function called 'setUp'.
+        Create a NetTestCase. To add futher setup steps before a set of tests
+        in a TestCase instance run, create a function called 'setUp'.
 
         Class attributes, such as `report`, `optParameters`, `name`, and
         `author` should be overriden statically as class attributes in any
-        subclass of :class:`ooni.nettest.TestCase`, so that the calling
-        functions in ooni.runner can handle them correctly.
+        subclass of :class:`ooni.nettest.NetTestCase`, so that the calling
+        functions during NetTestCase class setup can handle them correctly.
         """
         cls._raw_inputs   = __copyattr__(cls, "inputs")
         cls._input_file   = __copyattr__(cls, "inputFile")
@@ -212,7 +211,7 @@ class NetTestAdaptor(unittest.TestCase):
     @classmethod
     def __get_inputs__(cls):
         """
-        I am called from the ooni.runner and you probably should not override
+        I am called during class setup and you probably should not override
         me. I gather the internal inputs from :class:`NetTestCase` attributes
         and pass them through :meth:`NetTestCase.inputParser`.  If you are
         looking for a way to parse inputs from inputFile, see
diff --git a/ooni/utils/legacy.py b/ooni/utils/legacy.py
index 61fbe2f..3e21d97 100755
--- a/ooni/utils/legacy.py
+++ b/ooni/utils/legacy.py
@@ -153,7 +153,7 @@ class LegacyReporter(object):
         else:
             log.debug("ADD A NEW REPORT_TARGET TYPE!!")
 
-class LegacyOONITest(nettest.TestCase):
+class LegacyOONITest(nettest.NetTestCase):
     """
     Converts an old test, which should be a subclass of
     :class:`ooni.plugoo.tests.OONITest`, to an :mod:`ooni.oonicli`
diff --git a/ooni/utils/meta.py b/ooni/utils/meta.py
index 054e580..0b810f7 100644
--- a/ooni/utils/meta.py
+++ b/ooni/utils/meta.py
@@ -79,12 +79,12 @@ class MetaDescriptor(type):
     Q: Why all this fuss?
 
     A: We need to force future class-level attributes of subclasses of
-       TestCase to be accessible (also at the class-level, without
-       instatiations) by TestCase. I.e.:
-           1) class SubTestCase has class attribute optParameters, but no
+       NetTestCase to be accessible (also at the class-level, without
+       instatiations) by NetTestCase. I.e.:
+           1) class SubNetTestCase has class attribute optParameters, but no
               class for doing anything with them, and they shouldn't have to.
               They should just be able to define the options.
-           2) Therefore, TestCase needs to have data descriptors, which get
+           2) Therefore, NetTestCase needs to have data descriptors, which get
               inherited.
            3) We need to be able to do this without dangerous namespace
               munging, because we cannot control the namespace of future
@@ -182,8 +182,8 @@ class MetaDescriptor(type):
     ## just need @property's name, initial value can be None
 
 Metaclass
-   Creates Metaclasses for each data descriptor in each SubTestCase
-        so, per SubTestCase, we get (usually two) descriptors:
+   Creates Metaclasses for each data descriptor in each SubNetTestCase
+        so, per SubNetTestCase, we get (usually two) descriptors:
         optParameters and input
 
 '''
@@ -215,7 +215,7 @@ def applyClassAttribute(obj, cls, get='optParameters'):
         assert isNotClass(obj), "must be an instance"
         assert isClass(cls), "not a class"
                                         ## obj is probably an instance
-        C = obj.__class__               ## of a subclass of nettest.TestCase
+        C = obj.__class__               ## of a subclass of nettest.NetTestCase
 
         assert issubclass(C, cls), "not a subclass of %s" % cls
         assert C.__dict__.__contains__('optParameters'), \





More information about the tor-commits mailing list