diff --git a/qutebrowser/browser/history.py b/qutebrowser/browser/history.py index 5b061c1c4..2e264ffd7 100644 --- a/qutebrowser/browser/history.py +++ b/qutebrowser/browser/history.py @@ -68,6 +68,7 @@ class Entry: @classmethod def from_str(cls, line): + """Parse a history line like '12345 http://example.com title'.""" data = line.split(maxsplit=2) if len(data) == 2: atime, url = data @@ -210,7 +211,7 @@ class WebHistory(QObject): self._initial_read_done = True self.async_read_done.emit() - for url, entry in self._temp_history.items(): + for entry in self._temp_history.values(): self._add_entry(entry) if not entry.hidden: self._new_history.append(entry) @@ -272,7 +273,6 @@ class WebHistory(QObject): self._add_entry(entry, target=self._temp_history) - def init(parent=None): """Initialize the web history. diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index 21cbabc1e..847f47438 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -266,7 +266,6 @@ def webframe(webpage): @pytest.fixture def fake_keyevent_factory(): """Fixture that when called will return a mock instance of a QKeyEvent.""" - def fake_keyevent(key, modifiers=0, text='', typ=QEvent.KeyPress): """Generate a new fake QKeyPressEvent.""" evtmock = unittest.mock.create_autospec(QKeyEvent, instance=True) diff --git a/tests/unit/browser/test_cookies.py b/tests/unit/browser/test_cookies.py index d27d118f6..28f92ac59 100644 --- a/tests/unit/browser/test_cookies.py +++ b/tests/unit/browser/test_cookies.py @@ -19,14 +19,11 @@ """Tests for qutebrowser.browser.cookies.""" -from unittest import mock - from PyQt5.QtNetwork import QNetworkCookie from PyQt5.QtCore import QUrl import pytest from qutebrowser.browser import cookies -from qutebrowser.utils import objreg from qutebrowser.misc import lineparser CONFIG_ALL_COOKIES = {'content': {'cookies-accept': 'all'}} diff --git a/tests/unit/browser/test_history.py b/tests/unit/browser/test_history.py index aaadc02b0..52d95f8cc 100644 --- a/tests/unit/browser/test_history.py +++ b/tests/unit/browser/test_history.py @@ -38,7 +38,6 @@ def test_init(hist, fake_save_manager): def test_adding_item_during_async_read(qtbot, hist): """Check what happens when adding URL while reading the history.""" - with qtbot.assertNotEmitted(hist.add_completion_item), \ qtbot.assertNotEmitted(hist.item_added): hist.add_url(QUrl('http://www.example.com/')) @@ -56,7 +55,8 @@ def test_adding_item_during_async_read(qtbot, hist): def test_private_browsing(qtbot, tmpdir, fake_save_manager, config_stub): """Make sure no data is saved at all with private browsing.""" config_stub.data = {'general': {'private-browsing': True}} - private_hist = history.WebHistory(hist_dir=str(tmpdir), hist_name='history') + private_hist = history.WebHistory(hist_dir=str(tmpdir), + hist_name='history') # Before initial read with qtbot.assertNotEmitted(private_hist.add_completion_item), \