예제 #1
0
def qapp():
    """
    fixture that instantiates the QApplication instance that will be used by
    the tests.
    """
    app = qt_api.QApplication.instance()
    if app is None:
        global _qapp_instance
        _qapp_instance = qt_api.QApplication([])
        yield _qapp_instance
    else:
        yield app  # pragma: no cover
예제 #2
0
파일: plugin.py 프로젝트: sgaist/pytest-qt
def qapp(qapp_args):
    """
    Fixture that instantiates the QApplication instance that will be used by
    the tests.

    You can use the ``qapp`` fixture in tests which require a ``QApplication``
    to run, but where you don't need full ``qtbot`` functionality.
    """
    app = qt_api.QApplication.instance()
    if app is None:
        global _qapp_instance
        _qapp_instance = qt_api.QApplication(qapp_args)
        yield _qapp_instance
    else:
        yield app  # pragma: no cover
예제 #3
0
def qapp(qapp_args, pytestconfig):
    """
    Fixture that instantiates the QApplication instance that will be used by
    the tests.

    You can use the ``qapp`` fixture in tests which require a ``QApplication``
    to run, but where you don't need full ``qtbot`` functionality.
    """
    app = qt_api.QApplication.instance()
    if app is None:
        global _qapp_instance
        _qapp_instance = qt_api.QApplication(qapp_args)
        name = pytestconfig.getini("qt_qapp_name")
        _qapp_instance.setApplicationName(name)
        return _qapp_instance
    else:
        return app  # pragma: no cover