Exemplo n.º 1
0
def handleLoadingModeAction(mode):
    from Interaction import setInteractor
    choices = LoadingModeArgumentParser.ChoicesVals

    if mode == choices.GUI:
        from Interaction.GuiInteractor import GuiInteractor
        setInteractor(GuiInteractor())
    elif mode == choices.CLI:
        from Interaction.ConsoleInteractor import ConsoleInteractor
        setInteractor(ConsoleInteractor())
    elif mode == choices.CLI_SILENT:
        from Interaction.ConsoleSilentInteractor import ConsoleSilentInteractor
        setInteractor(ConsoleSilentInteractor())
    elif mode == choices.BY_CONFIG:
        from Interaction import setDefaultInteractorByConfig
        setDefaultInteractorByConfig()
Exemplo n.º 2
0
from Interaction import setInteractor
from Interaction import ConsoleSilentInteractor
setInteractor(ConsoleSilentInteractor.ConsoleSilentInteractor())

from Utils import DownloadSubAsBytesIO
from SubStages import QuerySubStage

from TestUtils import WriteTestLog, RandomItemFromList

class BaseSubProviderTest(object):       
    """
    Abstract/Base class for testing the SubProvider. The real SubProvider 
    implementation is not known to this class, and should be set by the 
    deriving class. 

    Notice that the class does not derive from unittest.TestCase. We do so 
    in order to bypass the unittest module logic for locating tests in the 
    project. If we're not deriving from TestCase, then we're not a test class
    for the unittest module. On the other hand, we do implement the TestCase
    interface (By the fact that we implement the test_xxx methods. The result
    behaviour is that when the Real provider's test class will derive from us
    and also from unittest.TestCase it will automatically be treated as a Test-
    Case by the unittest module.

    In order to us this class define the test class as follows:

    class SomeSubProviderTest(unittest.TestCase, BaseSubProviderTest):
        def setUp(self):
            BaseSubProviderTest.__init__(self, SomeSubProvider())
    """