예제 #1
0
    def checkOptions(self):
        """
        Call processTest and processOptions methods of each NetTestCase
        """
        for klass in self.testClasses:
            options = self.usageOptions()
            try:
                options.parseOptions(self.options)
            except usage.UsageError:
                tb = sys.exc_info()[2]
                raise e.OONIUsageError(self), None, tb

            if options:
                klass.localOptions = options
            # XXX this class all needs to be refactored and this is kind of a
            # hack.
            self.setTestDetails()

            test_instance = klass()
            if test_instance.requiresRoot and not hasRawSocketPermission():
                raise e.InsufficientPrivileges
            if test_instance.requiresTor:
                self.requiresTor = True
            test_instance.requirements()
            test_instance._checkRequiredOptions()
            test_instance._checkValidOptions()
예제 #2
0
 def parseLocalOptions(self):
     """
     Parses the localOptions for the NetTestLoader.
     """
     self.localOptions = self.usageOptions()
     try:
         self.localOptions.parseOptions(self.options)
     except usage.UsageError:
         tb = sys.exc_info()[2]
         raise e.OONIUsageError(self), None, tb