Exemplo n.º 1
0
    def __init__(self, first_arg=None):
        #Initialize the class if inheriting from TestCase
        if isinstance(self, TestCase): #If using unittest, then initialize the class
            #Keep signature
            if isinstance(first_arg, str):
                methodName = first_arg
                first_arg = None
                TestCase.__init__(self, methodName)
            else:
                TestCase.__init__(self)

        context = first_arg
        #Solve context if not provided
        if context == None:
            if ExposedTestBase.tests_context == None: #To enable context free initialization supporting unittest.TestCase
                self.__runs_from_tested_module = False
                ExposedTestBase.tests_context = SimpleRpcContext(self.__class__.__name__)
            else:
                self.__runs_from_tested_module = True
            context = ExposedTestBase.tests_context
        SimpleRpcLogicBase.__init__(self, context)