コード例 #1
0
def run_shell_nosetest(filename):
    """
    Special helper function for starting shell GUI tests from main (NOT from nosetests).
    On linux, simply runs the test like any other nose test.
    On Mac, starts nose in a separate thread and executes the GUI in the main thread.
    """
    def run_nose():
        import sys
        sys.argv.append(
            "--nocapture"
        )  # Don't steal stdout.  Show it on the console as usual.
        sys.argv.append(
            "--nologcapture"
        )  # Don't set the logging level to DEBUG.  Leave it alone.
        nose.run(defaultTest=filename)

    # On darwin, we must run nose in a separate thread and let the gui run in the main thread.
    # (This means we can't run this test using the nose command line tool.)
    if "Darwin" in platform.platform():
        noseThread = threading.Thread(target=run_nose)
        noseThread.start()

        from tests.helpers.mainThreadHelpers import wait_for_main_func
        wait_for_main_func()
        noseThread.join()
    else:
        # Linux: Run this test like usual (as if we're running from the command line)
        run_nose()
コード例 #2
0
def run_shell_nosetest(filename):
    """
    Launch nosetests from a separate thread, and pause this thread while the test runs the GUI in it.
    """
    # This only works from the main thread.
    assert threading.current_thread().getName() == "MainThread"

    def run_nose():
        sys.argv.append("--nocapture")    # Don't steal stdout.  Show it on the console as usual.
        sys.argv.append("--nologcapture") # Don't set the logging level to DEBUG.  Leave it alone.
        nose.run(defaultTest=filename)

    noseThread = threading.Thread(target=run_nose)
    noseThread.start()

    wait_for_main_func()
    noseThread.join()
コード例 #3
0
def run_shell_nosetest(filename):
    """
    Launch nosetests from a separate thread, and pause this thread while the test runs the GUI in it.
    """
    # This only works from the main thread.
    assert threading.current_thread() == threading.enumerate()[0]

    def run_nose():
        sys.argv.append(
            "--nocapture"
        )  # Don't steal stdout.  Show it on the console as usual.
        sys.argv.append(
            "--nologcapture"
        )  # Don't set the logging level to DEBUG.  Leave it alone.
        nose.run(defaultTest=filename)

    noseThread = threading.Thread(target=run_nose)
    noseThread.start()

    wait_for_main_func()
    noseThread.join()
コード例 #4
0
def run_shell_nosetest(filename):
    """
    Special helper function for starting shell GUI tests from main (NOT from nosetests).
    On linux, simply runs the test like any other nose test.
    On Mac, starts nose in a separate thread and executes the GUI in the main thread.
    """
    def run_nose():
        import sys
        sys.argv.append("--nocapture")    # Don't steal stdout.  Show it on the console as usual.
        sys.argv.append("--nologcapture") # Don't set the logging level to DEBUG.  Leave it alone.
        nose.run(defaultTest=filename)

    # On darwin, we must run nose in a separate thread and let the gui run in the main thread.
    # (This means we can't run this test using the nose command line tool.)
    if "Darwin" in platform.platform():
        noseThread = threading.Thread(target=run_nose)
        noseThread.start()

        from tests.helpers.mainThreadHelpers import wait_for_main_func
        wait_for_main_func()
        noseThread.join()
    else:
        # Linux: Run this test like usual (as if we're running from the command line)
        run_nose()