Exemplo n.º 1
0
def cleanup():
    """Kill the running subprocesses and server fired in this program, set
    constants back to default values.
    """
    google_app_engine_path = '%s/' % common.GOOGLE_APP_ENGINE_SDK_HOME
    webdriver_download_path = '%s/selenium' % WEBDRIVER_HOME_PATH
    if common.is_windows_os():
        # In windows system, the java command line will use absolute path.
        webdriver_download_path = os.path.abspath(webdriver_download_path)
    processes_to_kill = [
        '.*%s.*' % re.escape(google_app_engine_path),
        '.*%s.*' % re.escape(webdriver_download_path)
    ]
    for p in SUBPROCESSES:
        _kill_process(p)

    for p in processes_to_kill:
        common.kill_processes_based_on_regex(p)

    build.set_constants_to_default()
    common.stop_redis_server()

    for port in [OPPIA_SERVER_PORT, GOOGLE_APP_ENGINE_PORT]:
        if not common.wait_for_port_to_be_closed(port):
            raise RuntimeError(
                'Port {} failed to close within {} seconds.'.format(
                    port, common.MAX_WAIT_TIME_FOR_PORT_TO_CLOSE_SECS))
Exemplo n.º 2
0
def cleanup():
    """Kill the running subprocesses and server fired in this program."""
    google_app_engine_path = '%s/' % common.GOOGLE_APP_ENGINE_HOME
    webdriver_download_path = '%s/downloads' % WEBDRIVER_HOME_PATH
    if common.is_windows_os():
        # In windows system, the java command line will use absolute path.
        webdriver_download_path = os.path.abspath(webdriver_download_path)
    processes_to_kill = [
        '.*%s.*' % re.escape(google_app_engine_path),
        '.*%s.*' % re.escape(webdriver_download_path)
    ]
    for p in SUBPROCESSES:
        p.kill()

    for p in processes_to_kill:
        common.kill_processes_based_on_regex(p)
Exemplo n.º 3
0
def cleanup():
    """Deactivates webpages and deletes html lighthouse reports."""
    pattern = '"ENABLE_ACCOUNT_DELETION": .*'
    replace = '"ENABLE_ACCOUNT_DELETION": false,'
    common.inplace_replace_file(common.CONSTANTS_FILE_PATH, pattern, replace)

    build.set_constants_to_default()

    google_app_engine_path = '%s/' % common.GOOGLE_APP_ENGINE_SDK_HOME
    processes_to_kill = [
        '.*%s.*' % re.escape(google_app_engine_path),
    ]
    for p in SUBPROCESSES:
        p.kill()

    for p in processes_to_kill:
        common.kill_processes_based_on_regex(p)

    common.stop_redis_server()
Exemplo n.º 4
0
def cleanup():
    """Kill the running subprocesses and server fired in this program, set
    constants back to default values.
    """
    google_app_engine_path = '%s/' % common.GOOGLE_APP_ENGINE_SDK_HOME
    webdriver_download_path = '%s/selenium' % WEBDRIVER_HOME_PATH
    if common.is_windows_os():
        # In windows system, the java command line will use absolute path.
        webdriver_download_path = os.path.abspath(webdriver_download_path)
    processes_to_kill = [
        '.*%s.*' % re.escape(google_app_engine_path),
        '.*%s.*' % re.escape(webdriver_download_path)
    ]
    for p in SUBPROCESSES:
        p.kill()

    for p in processes_to_kill:
        common.kill_processes_based_on_regex(p)
    build.set_constants_to_default()
    common.stop_redis_server()