Commit Graph

318 Commits

Author SHA1 Message Date
Florian Bruhin
3e0ca5d94d Stop using objreg for state-config 2017-09-17 21:04:34 +02:00
Florian Bruhin
5aa653a54f Fix IPC socket location test
We use fake_runtime_dir which simply patches XDG_RUNTIME_DIR for this test.
Since we patch QApplication.applicationName() during the tests, but standarddir
doesn't use that anymore, we get a different name.
2017-09-17 09:49:06 +02:00
Florian Bruhin
e87a782411 Move command-history init to cmdhistory.py 2017-09-15 14:27:15 +02:00
Florian Bruhin
56bbd73622 Introduce standarddir caching
This makes things a bit more complicated, but is needed to make standarddir (and
thus the config) work without a QApplication.
2017-09-13 17:26:56 +02:00
Ryan Roden-Corrent
111846a909 Merge remote-tracking branch 'upstream/master' into configmerge 2017-08-20 21:18:47 -04:00
Florian Bruhin
a20f017c7a Sort sessions in SessionMnager.list_sessions() 2017-08-08 07:56:10 +02:00
Ryan Roden-Corrent
71b71dbc58 Merge remote-tracking branch 'upstream/master' into HEAD 2017-08-06 18:13:49 -04:00
Ryan Roden-Corrent
8e34b54cd7 Remove obsolete signals.
The added/removed signals for the urlmark managers are no longer used as
the completion models are generated on-the-fly. The changed signal is
still needed so the save-manager knows when to trigger a write to disk.

Also removes session_manager.update_completion, which is no longer
needed for the same reason as above.

keyconf.changed cannot be removed, as it is still wired up to
basekeyparser.

Resolves #2874.
2017-07-29 13:09:10 -04:00
Florian Bruhin
56b4989f44 Fix tests for QProcess changes 2017-07-23 22:10:50 +02:00
Florian Bruhin
fba25338be Merge pull request #2295 from rcorre/really_complete
Completion refactor V3
2017-07-21 15:05:43 +02:00
Florian Bruhin
bb567a61b6 Fix ipc test coverage 2017-07-09 22:09:31 +02:00
Florian Bruhin
cd063c74d9 Why is my commit -a broken 2017-07-09 12:54:19 +02:00
Florian Bruhin
6a2163d36f ipc: Remove support for connecting to legacy servers 2017-07-09 12:49:47 +02:00
Florian Bruhin
ad615941a2 Replace OS X with macOS 2017-07-08 11:12:43 +02:00
Ryan Roden-Corrent
dc4472470e Merge remote-tracking branch 'upstream/master' into really_complete 2017-07-05 08:45:57 -04:00
Florian Bruhin
cff61fa0bc Fix pylint
This also reverts commit 8df0b063be.
2017-07-04 15:34:10 +02:00
Florian Bruhin
b42265212b Update test_keyhints for new config
This also makes the keyhint display things sorted
2017-07-04 15:08:04 +02:00
Florian Bruhin
22b0f2fd24 Various simple test updates for new config
test_cache
test_cookies
test_webkitelem
test_cmdutils
test_runners
test_completionwidget
test_messageview
test_editor
test_miscwidgets
test_sessions
test_urlutils
test_utils
test_prompt
statusbar/test_*
test_cmdhistory
test_tabwidget
test_tab
test_downloads
test_networkmanager
2017-07-04 15:08:04 +02:00
Florian Bruhin
d0904a9f67 Adjust test settings 2017-07-04 15:08:02 +02:00
Ryan Roden-Corrent
1e1335aa5e Make various SQL code review changes.
- Fix outdated comments
- Use mock specs when possible
- More precise error message check in test_import_txt_invalid.
- Fix copyright message
- Tweak missing pyqt error message
- Dead code: remove group_by and where from sqlcategory.
  With the new separate completion table, these are no longer used.
- Move test_history out of webkit/. History is no longer purely webkit
  related, it could be webengine.
2017-07-03 09:45:08 -04:00
Florian Bruhin
3b53ec1cb6 Skip tests with permission changes if they didn't work
This e.g. wouldn't work inside of a Docker container otherwise.
2017-07-03 10:07:40 +02:00
Ryan Roden-Corrent
262b028ee9 Match error message in lineparser test. 2017-06-29 20:49:05 -04:00
Ryan Roden-Corrent
c007f592b3 Use more intuitive argument order in sql.delete. 2017-06-29 20:43:42 -04:00
Florian Bruhin
994e8c692f Merge different FakeTabbedBrowser objects 2017-06-20 15:19:53 +02:00
Ryan Roden-Corrent
891a6bcf14 Fix flake8 errors 2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
4e87773d89 Use a dict instead of named params for insert.
This allows replace to be a named parameter and allows consolidating
some duplicate code between various insert methods.

This also fixes some tests that broke because batch insert was broken.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
22b7b21d5a Use named placeholders for sql queries. 2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
478a719f77 Use a prepared query for historyContains.
This is called often, hopefully a prepared query will speed it up.
This also modifies Query.run to return self for easier chaining, so you
can use `query.run.value()` instead of `query.run` ; query.value()`.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
39b561a182 Fix BaseLineParser::test_double_open.
Don't tie the test to a particular error message. Ths failed because a
typo was fixed (AppendLineParser -> LineParser).
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
20000088de Add debug-dump-history and fix sql history tests.
Trying to read from the sql database from another process was flaky.
This adds a debug-dump-history command which is used by the history BDD
tests to validate the history contents.

It outputs history in the old pre-SQL text format, so it might be
useful for those who want to manipulate their history as text.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
784d9bb043 Remove code rendered dead by sql implementation.
Vulture exposed the following dead code:

- AppendLineParse was only used for reading the history text file, which is now
  a sql database (and the import code for the old text file is simpler and does
  not need a complex line parser)

- async_read_done is no longer used as importing the history text file is
  synchronous (and should only happen once)

- config._init_key_config is unused as it was moved to keyconf.init
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
f110cf4d53 Fix long hang after importing history.
Turns out historyContains was getting called for the webkit backend multiple
times when the browser starts. This was calling `url in history`, which was
enumerating the entire history as `__contains__` was not defined.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
8ff45331df Clean up sql implementation.
Now that sql is only used for history (not quickmarks/bookmarks) a number of
functions are no longer needed. In addition, primary key support was removed as
we actually need to support multiple entries for the same url with different
access times. The completion model will have to handle this by selecting
something like (url, title, max(atime)).

This also fixes up a number of tests that were broken with the last few
sql-related commits.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
de5be0dc5a Store history in an on-disk sqlite database.
Instead of reading sqlite history from a file and storing it in an in-memory
database, just directly use an on-disk database. This resolves #755, where
history entries don't pop in to the completion menu immediately as they are
still being read asynchronously for a few seconds after the browser starts.
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
56f3b3a027 Small review fixups for SQL implementation.
Respond to the low-hanging code review fruit:

- Clean up some comments
- Remove an acidentally added duplicate init_autosave
- Combine two test_history tests
- Move test_init cleanup into a fixture to ensure it gets called.
- Name the _ argument of bind(_) to _key
- Ensure index is valid for first_item/last_item
- Move SqlException to top of module
- Rename test_index to test_getitem
- Return QItemFlags.None instead of None
- Fix copyright dates (its 2017 now!)
- Use * to force some args to be keyword-only
- Make some returns explicit
- Add sql to LOGGER_NAMES
- Add a comment to explain the sql escape statement
2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
3c676f9562 Fix pylint/flake8 errors for SQL work. 2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
a050cb94f6 Report sqlite version with --version. 2017-06-19 07:44:11 -04:00
Ryan Roden-Corrent
df995c02a3 Get rid of varargs in sql.run_query.
Things are clearer when just passing a list.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
839d49a8ac Fix up pylint/flake8 for completion revamp. 2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
a774647c26 Get test_models mostly working again.
- Adjust _check_completions to work for CompletionModel and SqlCompletionModel
- Move sql initialization into a reusable fixture
- Remove the bookmark/quickmark/history stubs, as they're now handled by sql
- Disable quickmark/bookmark model tests until their completion is ported to
  sql.
- Disable urlmodel tests for features that have to be implemented in SQL:
    - LIMIT (for history-max-items)
    - Configurable column order (for quickmarks)
    - Configurable formatting (for timestamp-format
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
f43f78c40f Implement SQL interface.
When qutebrowser starts, it creates an in-memory sqlite database. One
can instantiate a SqlTable to create a new table in the database. The
object provides an interface to query and modify the table.

This intended to serve as the base class for the quickmark, bookmark,
and history manager objects in objreg. Instead of reading their data
into an in-memory dict, they will read into an in-memory sql table.

Eventually the completion models for history, bookmarks, and quickmarks
can be replaced with SqlQuery models for faster creation and filtering.

See #1765.
2017-06-19 07:42:12 -04:00
Florian Bruhin
df6c4c6e73 Fix earlyinit.qt_version issues 2017-06-19 09:42:49 +02:00
Florian Bruhin
fdba676933 Move version.qt_version() to earlyinit
Importing version in earlyinit is a bad idea, as it already pulls in a lot of
stuff we don't want.
2017-06-19 08:57:29 +02:00
Florian Bruhin
27ea9a6954 Fix test_debug_trace 2017-06-05 20:17:39 +02:00
Florian Bruhin
7186dcb98f Send crash reports to private pastebin
Fixes #481
2017-05-29 09:20:10 +02:00
Florian Bruhin
ea2fbc427a tests: Use match= for pytest.raises 2017-05-23 09:36:00 +02:00
Florian Bruhin
af7923de4d tests: Use pytest.param 2017-05-23 08:08:46 +02:00
Florian Bruhin
00a7a0cee6 Reorganize pylint config
This removes various stuff we don't need anymoe, and also re-enables and fixes
the import order check.
2017-05-17 20:20:12 +02:00
Florian Bruhin
c6e31391de Fix most tests/lint 2017-05-10 09:19:24 +02:00
Florian Bruhin
1c50377c0a Initial work on new private browsing 2017-05-10 07:00:21 +02:00
Florian Bruhin
822623f2ed Finally update copyrights... 2017-05-09 21:37:03 +02:00
Florian Bruhin
004eb742f6 Stabilize test_guiprocess 2017-03-31 13:05:34 +02:00
Florian Bruhin
a55d1b1ee8 Save old socket for IPC
At least on Windows with Qt 5.8, we get readyRead notifications *after*
disconnect...
2017-03-31 13:03:17 +02:00
Ryan Roden-Corrent
a68f997d95 Make keyhint delay configurable.
ui.keyhint-delay controls the time from starting a keychain to showing the
keyhint dialog. Resolves #2462.
2017-03-22 21:50:26 -04:00
Florian Bruhin
5fb6d26465 Stabilize some tests 2017-03-06 06:28:26 +01:00
Florian Bruhin
199a2ffe27 Remove unneeded deleted attribute for FakeSocket 2017-03-05 15:15:12 +01:00
Florian Bruhin
5d0c9440f6 Fix monkeypatch 2017-03-01 12:12:40 +01:00
Florian Bruhin
ca4f249c30 Use three-argument form of monkeypatch.*attr 2017-03-01 11:33:41 +01:00
Florian Bruhin
29ffa3d134 Add a fullscreen notification overlay
From the spec:

  User agents should ensure, e.g. by means of an overlay, that the end user is
  aware something is displayed fullscreen. User agents should provide a means of
  exiting fullscreen that always works and advertise this to the user. This is
  to prevent a site from spoofing the end user by recreating the user agent or
  even operating system environment when fullscreen.

https://fullscreen.spec.whatwg.org/#security-and-privacy-considerations
2017-02-06 16:22:58 +01:00
Florian Bruhin
de50f30b9b Replace all GitHub links 2017-02-05 00:13:11 +01:00
Florian Bruhin
81d67f8a2c Remove support for an empty data/config/cachedir
See #2115
2016-11-14 23:13:21 +01:00
Florian Bruhin
a8d1187ba0 Fix keyhint tests 2016-11-03 08:40:41 +01:00
Florian Bruhin
b4872192c3 Merge branch 'more-tests' of https://github.com/HolySmoke86/qutebrowser into HolySmoke86-more-tests 2016-10-30 23:24:15 +01:00
Daniel Karbach
cfa9068eed flake...
*quitely shakes fist and then submits*
2016-10-28 11:23:05 +02:00
Daniel Karbach
6fff45daeb check exception messages in utilcmds tests 2016-10-28 10:50:58 +02:00
Daniel Karbach
e167f77d68 separate test for hunter exceptions 2016-10-28 10:44:55 +02:00
Daniel Karbach
6e510372fb more cleanup
jeez, this is getting embarrassing
2016-10-27 15:50:17 +02:00
Daniel Karbach
23a62e952d another lineparser/utilcmds test revision
* verify exception message in lineparser double open
* check for hunter with `pytest.importorskip`
* stricter exception checking in debug_trace test
2016-10-27 14:56:28 +02:00
Daniel Karbach
64cf8fcd39 lineparser/utilcmds test cleanup
* fix date in copyright
* remove redundant class docstrings
* don't rename utilcmds module in unit test
* use `mode_manager` fixture in place of FakeModeMan
* some whitespace
2016-10-27 14:23:01 +02:00
Florian Bruhin
ece3f3a2e1 Update to pytest-qt 2.1.0 2016-10-26 07:42:41 +02:00
Daniel Karbach
442549555b skip segfault test on windows
while technically possible (on both machine and OS level), termination due
to SIGSEGV cannot be prevented
maybe the test could be rewritten to spawn a subprocess and check its exit
status (of 11)
2016-10-25 17:24:14 +02:00
Daniel Karbach
9038b28ea4 different mocking of open() in lineparser test
apparently, python 3.4 (and less, probably) does not import
builtins into modules
2016-10-25 08:52:08 +02:00
Daniel Karbach
b5ffe979aa "typo" in utilcmds test 2016-10-25 08:48:04 +02:00
Daniel Karbach
e0d1fafe43 tests for misc.utilcmds 2016-10-24 17:13:38 +02:00
Daniel Karbach
bdb96becd6 unit tests for misc.lineparser 2016-10-24 17:10:47 +02:00
Florian Bruhin
ab7cbfdea0 Improve keyhint tests
This also brings them back to 100% coverage
2016-09-25 16:42:13 +02:00
Florian Bruhin
123aace3e8 Fix keyhint tests 2016-09-23 15:05:01 +02:00
Florian Bruhin
49f8fa6d76 Add some tests for earlyinit.fix_harfbuzz
See #1948
2016-09-16 08:43:12 +02:00
Florian Bruhin
7e30792bfe Fix lint 2016-09-15 14:51:22 +02:00
Florian Bruhin
fce9783570 Fix unit tests
Apart from changed parameters, messages now log even when messagemock is
used, so we needed to add a few caplog.at_level calls.
2016-09-15 14:51:22 +02:00
Florian Bruhin
a2254b671c Adjust tests/messagemock 2016-09-15 14:51:21 +02:00
Florian Bruhin
f16b96aa28 Initial implementation of new messages 2016-09-15 14:51:21 +02:00
Florian Bruhin
2df971a79c Move short_tmpdir fixture to conftest.py 2016-09-09 18:46:51 +02:00
Florian Bruhin
7f013b7808 Fix lint 2016-09-06 17:00:25 +02:00
Florian Bruhin
4f55b435f0 Move various session unit tests to BDD tests 2016-09-06 13:55:28 +02:00
Florian Bruhin
f6ba859896 Move tabhistory.TabHistoryItem to misc.sessions
This makes browser.webkit.tabhistory contain only QtWebKit-specific
code.
2016-09-06 09:50:55 +02:00
Florian Bruhin
7592345b6e Make unittests work without QtWebKit 2016-09-05 18:45:50 +02:00
Florian Bruhin
cf070d48f2 WebEngine: Disable createWindow for Qt < 5.7.1
Fixes #1911.

The bugfix is backported in my qt5-webengine-debug package, and
QUTE_QTBUG54419_PATCHED can be set to force qutebrowser to use
createWindow.
2016-09-05 15:08:00 +02:00
Florian Bruhin
1e601d3419 Add apikey to test_pastebin.py 2016-09-02 06:10:21 +02:00
Florian Bruhin
df3733af54 tests: Use pytest.fixture instead of yield_fixture
See #1877
2016-08-22 07:40:24 +02:00
Daniel Schadt
4d00b8fce9 tests: fix tests for misc.editor
Due to the change to NamedTemporaryFile, the _filename attribute was
removed. We now have to use _file.name.
2016-08-07 00:18:22 +02:00
Florian Bruhin
2b496a81ef tests: Use parametrize for parse_fatal_stacktrace 2016-08-05 09:01:09 +02:00
Florian Bruhin
029ea2e5a7 Add miscwidgets.WrapperLayout.wrap
This makes it easier for an user of WrapperLayout to wrap a widget.
2016-08-04 19:22:44 +02:00
Florian Bruhin
dbccb12b49 Move WrapperLayout to miscwidgets 2016-08-03 13:08:25 +02:00
Florian Bruhin
483072d842 Don't use QSignalSpy in IPC test
Fixes #1727.

For another testcase in the same file we still need to use it until
pytest-qt has a MultiSignalBlocker.args.
2016-08-02 12:45:30 +02:00
Ryan Roden-Corrent
86a08d17c2 Dedupe code in test_readline.
Many of the tests repeated the same block of logic, so consolidate it
into one function.
2016-07-30 22:00:12 -04:00
Ryan Roden-Corrent
a086095954 Implement unix_filename_rubout.
unix_filename_rubout deletes to the previous slash or whitespace,
unlike the previously implemented backwards-kill-word which treats and
non-alphanumeric character as a boundary.

To illustrate, given the text 'foo/bar.baz', unix_filename_rubout will
delete 'bar.baz' while backwards-kill-word will delete only 'baz'.

See #1710.
2016-07-30 19:34:38 -04:00
Ryan Roden-Corrent
6bcdacf1ce Implement readline's backward-kill-word.
This restores the previous behavior of `unix-word-rubout` as
`backward-kill-word`, which is closer to the naming used in readline.
It is bound to <Alt-Backspace> by default, though <Ctrl-Backspace> will
also work due to a builtin binding.

Resolves #1698.
2016-07-30 07:27:29 -04:00
Florian Bruhin
4bf94f3c24 Use order='strict' with qtbot.waitSignals
See #1702
2016-07-29 09:12:06 +02:00
Florian Bruhin
a7e9b4e5d7 Get rid of extend=True for qt_log_ignore
This is now the default, see #1702
2016-07-29 09:12:06 +02:00