Example #1
0
from TriblerGUI.dialogs.feedbackdialog import FeedbackDialog
from TriblerGUI.widgets.channel_torrent_list_item import ChannelTorrentListItem
from TriblerGUI.widgets.home_recommended_item import HomeRecommendedItem

api_port = get_random_port()
core_manager.START_FAKE_API = True

import TriblerGUI
TriblerGUI.defs.DEFAULT_API_PORT = api_port

from TriblerGUI.widgets.loading_list_item import LoadingListItem
from TriblerGUI.tribler_window import TriblerWindow

if os.environ.get("TEST_GUI") == "yes":
    app = QApplication(sys.argv)
    window = TriblerWindow(api_port=api_port)
    QTest.qWaitForWindowExposed(window)
else:
    window = None


def start_fake_core(port):
    from twisted.internet import reactor
    from twisted.web.server import Site

    from FakeTriblerAPI.endpoints.root_endpoint import RootEndpoint
    from FakeTriblerAPI.endpoints.video_root_endpoint import VideoRootEndpoint
    from FakeTriblerAPI.tribler_data import TriblerData
    import FakeTriblerAPI.tribler_utils as tribler_utils

    def generate_tribler_data():
Example #2
0
from TriblerGUI.dialogs.feedbackdialog import FeedbackDialog
from TriblerGUI.widgets.channel_torrent_list_item import ChannelTorrentListItem
from TriblerGUI.widgets.home_recommended_item import HomeRecommendedItem

rand_port = get_random_port()
core_manager.START_FAKE_API = True
gui_defs.API_PORT = rand_port

import TriblerGUI

from TriblerGUI.widgets.loading_list_item import LoadingListItem
from TriblerGUI.tribler_window import TriblerWindow

if os.environ.get("TEST_GUI") == "yes":
    app = QApplication(sys.argv)
    window = TriblerWindow()
    QTest.qWaitForWindowExposed(window)
else:
    window = None

sys.excepthook = sys.__excepthook__


class TimeoutException(Exception):
    pass


class AbstractTriblerGUITest(unittest.TestCase):
    """
    This class contains various utility methods that are used during the GUI test, i.e. methods that wait until
    some data in a list is loaded or for taking a screenshot of the current window.
Example #3
0
    if state_dir and os.path.exists(state_dir):
        shutil.rmtree(state_dir, ignore_errors=False, onerror=None)

    if not os.path.exists(state_dir):
        os.makedirs(state_dir)

    # Set up logging before starting the GUI
    setup_gui_logging()

    core_script_file = os.path.abspath(run_tribler.__file__)
    core_args = [core_script_file]

    # QT App initialization
    app = QApplication(sys.argv)
    window = TriblerWindow(core_args=core_args)

    # Wait till the window is shown
    QTest.qWaitForWindowExposed(window)
else:
    window = None

sys.excepthook = sys.__excepthook__
MAX_TIMEOUT = 60000


class TimeoutException(Exception):
    pass


class AbstractTriblerIntegrationTest(unittest.TestCase):
Example #4
0
    try:
        from TriblerGUI.tribler_app import TriblerApplication
        from TriblerGUI.tribler_window import TriblerWindow

        app = TriblerApplication("triblerapp", sys.argv)

        if app.is_running():
            for arg in sys.argv[1:]:
                if os.path.exists(arg) and arg.endswith(".torrent"):
                    app.send_message("file:%s" % arg)
                elif arg.startswith('magnet'):
                    app.send_message(arg)
            sys.exit(1)

        window = TriblerWindow()
        window.setWindowTitle("Tribler")
        app.set_activation_window(window)
        app.parse_sys_args(sys.argv)
        sys.exit(app.exec_())
    except ImportError as ie:
        logging.exception(ie)
        error_and_exit("Import Error", "Import error: {0}".format(ie))

    except SystemExit as se:
        logging.info("Shutting down Tribler")
        # Flush all the logs to make sure it is written to file before it exits
        for handler in logging.getLogger().handlers:
            handler.flush()
        raise
Example #5
0
rand_port = get_random_port()
core_manager.START_FAKE_API = True
core_manager.FAKE_API_PORT = rand_port

import TriblerGUI.tribler_request_manager as request_mgr
request_mgr.API_PORT = rand_port

import TriblerGUI

from TriblerGUI.widgets.loading_list_item import LoadingListItem
from TriblerGUI.tribler_window import TriblerWindow

if os.environ.get("TEST_GUI") == "yes":
    app = QApplication(sys.argv)
    window = TriblerWindow(api_port=rand_port)
    QTest.qWaitForWindowExposed(window)
else:
    window = None

sys.excepthook = sys.__excepthook__


class TimeoutException(Exception):
    pass


class AbstractTriblerGUITest(unittest.TestCase):
    """
    This class contains various utility methods that are used during the GUI test, i.e. methods that wait until
    some data in a list is loaded or for taking a screenshot of the current window.
Example #6
0
            setup_gui_logging()

            from TriblerGUI.tribler_app import TriblerApplication
            from TriblerGUI.tribler_window import TriblerWindow

            app = TriblerApplication("triblerapp", sys.argv)

            if app.is_running():
                for arg in sys.argv[1:]:
                    if os.path.exists(arg) and arg.endswith(".torrent"):
                        app.send_message("file:%s" % arg)
                    elif arg.startswith('magnet'):
                        app.send_message(arg)
                sys.exit(1)

            window = TriblerWindow()
            window.setWindowTitle("Tribler")
            app.set_activation_window(window)
            app.parse_sys_args(sys.argv)
            sys.exit(app.exec_())
        except ImportError as ie:
            logging.exception(ie)
            error_and_exit("Import Error", "Import error: {0}".format(ie))

        except TriblerException as te:
            logging.exception(te)
            error_and_exit("Tribler Exception", "{0}".format(te))

        except SystemExit as se:
            logging.info("Shutting down Tribler")
            # Flush all the logs to make sure it is written to file before it exits