tests.helpers: Clean up imports
This commit is contained in:
parent
346e59880e
commit
ef2b3cd6d9
@ -28,6 +28,7 @@ import sys
|
||||
import collections
|
||||
import itertools
|
||||
import textwrap
|
||||
import unittest.mock
|
||||
|
||||
import pytest
|
||||
|
||||
@ -37,6 +38,7 @@ from qutebrowser.utils import objreg
|
||||
from qutebrowser.browser import cookies
|
||||
|
||||
from PyQt5.QtCore import QEvent, QSize, Qt
|
||||
from PyQt5.QtGui import QKeyEvent
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout
|
||||
from PyQt5.QtNetwork import QNetworkCookieJar
|
||||
try:
|
||||
@ -263,12 +265,10 @@ def webframe(webpage):
|
||||
@pytest.fixture
|
||||
def fake_keyevent_factory():
|
||||
"""Fixture that when called will return a mock instance of a QKeyEvent."""
|
||||
from unittest import mock
|
||||
from PyQt5.QtGui import QKeyEvent
|
||||
|
||||
def fake_keyevent(key, modifiers=0, text='', typ=QEvent.KeyPress):
|
||||
"""Generate a new fake QKeyPressEvent."""
|
||||
evtmock = mock.create_autospec(QKeyEvent, instance=True)
|
||||
evtmock = unittest.mock.create_autospec(QKeyEvent, instance=True)
|
||||
evtmock.key.return_value = key
|
||||
evtmock.modifiers.return_value = modifiers
|
||||
evtmock.text.return_value = text
|
||||
|
Loading…
Reference in New Issue
Block a user