Esempio n. 1
0
    def playWrapper(filename):
        global singletons
        fauxroot.resetLogs()
        rpm.reset()
        vmkctl.reset()
        
        sys.path.append(os.path.join(TEST_DIR, DEFAULT_CONFIG_NAME))
        reload(fauxconfig)
        sys.path.pop()
        
        reload(userchoices)

        import customdrivers
        reload(customdrivers)
        
        import networking
        reload(networking.networking_base)

        import media
        reload(media)
        
        import gui
        reload(gui)

        import installlocation_gui
        reload(installlocation_gui)
        
        import timezone_gui
        reload(timezone_gui)
        
        import timedate_gui
        reload(timedate_gui)
        
        import datastore_gui
        reload(datastore_gui)
        
        import setupvmdk_gui
        reload(setupvmdk_gui)

        import network_address_widgets
        reload(network_address_widgets)
        
        # XXX sucks to have to reload to reset global state like this...
        for singletonClass in singletons:
            singletonClass._the_only_instance = None
        singletons = []

        oldDir = os.getcwd()
        try:
            os.chdir(os.path.join(TEST_DIR, os.pardir))
            kiwi.ui.test.runner.play_file(filename, None)
        except SystemExit, e:
            pass
Esempio n. 2
0
    def playWrapper(filename):
        global singletons
        fauxroot.resetLogs()
        rpm.reset()
        vmkctl.reset()

        sys.path.append(os.path.join(TEST_DIR, DEFAULT_CONFIG_NAME))
        reload(fauxconfig)
        sys.path.pop()

        reload(userchoices)

        import customdrivers
        reload(customdrivers)

        import networking
        reload(networking.networking_base)

        import media
        reload(media)

        import gui
        reload(gui)

        import installlocation_gui
        reload(installlocation_gui)

        import timezone_gui
        reload(timezone_gui)

        import timedate_gui
        reload(timedate_gui)

        import datastore_gui
        reload(datastore_gui)

        import setupvmdk_gui
        reload(setupvmdk_gui)

        import network_address_widgets
        reload(network_address_widgets)

        # XXX sucks to have to reload to reset global state like this...
        for singletonClass in singletons:
            singletonClass._the_only_instance = None
        singletons = []

        oldDir = os.getcwd()
        try:
            os.chdir(os.path.join(TEST_DIR, os.pardir))
            kiwi.ui.test.runner.play_file(filename, None)
        except SystemExit, e:
            pass
Esempio n. 3
0
def setup():
    '''Setup the cage, but do not enable the faux chroot.'''

    global STEPPER, LAST_OUTPUT, NEXT_INPUT
    global oldStdout, newStdout, oldStderr, newStderr
    
    fauxroot.resetLogs()
    rpm.reset()
    vmkctl.reset()

    sys.path.append(os.path.join(TEST_DIR, DEFAULT_CONFIG_NAME))
    import fauxconfig
    sys.path.pop()

    reload(fauxconfig)

    # XXX Need to reload modules with global data.
    import userchoices
    reload(userchoices)

    import remote_files
    remote_files.__cacher = None
    remote_files.__nfsMounter = None
    remote_files.NFSMounter._nfsUp = False

    import customdrivers
    reload(customdrivers)

    import media
    reload(media)

    import scui
    reload(scui)

    import networking
    reload(networking.networking_base)

    import boot_cmdline
    reload(boot_cmdline)

    import packages
    packages.__transactionSet = None
    
    textui.textengine._cons_input = _auto_input
    textui.textengine._password_cons_input = _auto_input
    textui.textengine._cons_output_oob = lambda x: x
    textui.textengine._cons_output = _auto_output

    STEPPER = Stepper()
    LAST_OUTPUT = ""
    NEXT_INPUT = None
    
    # Find the name of the doctest file that is being run.  XXX Evil
    st = inspect.stack()

    oldStdout = sys.stdout
    newStdout = fauxroot.CopyOnWriteFile()
    oldStderr = sys.stderr
    newStderr = fauxroot.CopyOnWriteFile()
    
    doctestName = None
    for frame in st:
        if frame[1].endswith("doctest.py"):
            doctestName = frame[0].f_locals['test'].filename
            break

    if doctestName:
        testContents = open(doctestName).read()

        # Get the kickstart commands from the top of the file.
        ksEnd = testContents.find(">>>")
        ksFile = testContents[:ksEnd]

        fauxroot.WRITTEN_FILES["/ks.cfg"] = fauxroot.CopyOnWriteFile(ksFile)