- 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.
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.
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()`.
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.
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
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.
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.
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.
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
- 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
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.
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
* 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
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)
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.
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.
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.
There'll be a refactoring to add a session API to WebTab later anyways,
so no point in fixing this now.
As many tests as possible here should probably also be changed to
end2end ones as there's a lot of mocking going on.
There were two different issues here:
- `\n` rather than `os.linesep` was used, which caused the "generated"
file to have less data in it than expected
- A final `os.linesep` (or `\n`) was missing, but that was cancelled out
by a off-by-one error when slicing, so wasn't an issue until we tried
with \r\n endings.
When using flake8-string-format on Python 3.5 with str.format(*group) it
failed:
Traceback (most recent call last):
File "./.venv-flakes/bin/flake8", line 11, in <module>
sys.exit(main())
File ".../site-packages/flake8/main.py", line 33, in main
report = flake8_style.check_files()
File ".../site-packages/flake8/engine.py", line 181, in check_files
return self._retry_serial(self._styleguide.check_files, paths=paths)
File ".../site-packages/flake8/engine.py", line 172, in _retry_serial
return func(*args, **kwargs)
File ".../site-packages/pep8.py", line 1842, in check_files
runner(path)
File ".../site-packages/flake8/engine.py", line 126, in input_file
return fchecker.check_all(expected=expected, line_offset=line_offset)
File ".../site-packages/pep8.py", line 1574, in check_all
self.check_ast()
File ".../site-packages/pep8.py", line 1521, in check_ast
for lineno, offset, text, check in checker.run():
File ".../site-packages/flake8_string_format.py", line 288, in run
assert isinstance(call.args, ast.Starred) is bool(has_starargs)
AssertionError
This works around that issue.
See https://github.com/xZise/flake8-string-format/issues/11
Replace the setting ui.show-keyhints with ui.keyhint-blacklist, which
is a list of globs for keychains that shouldn't be hinted. This allows
users to prevent showing keyhints for keychains they already know.
keyhint-blacklist='*' is equivalent to show-keyhints=False.
Resolves#1515.
If a user knows the keychain and can type it quickly, we shouldn't
annoy them with a popup. Only show the keyhint if the user doesn't
complete their keychain in 500ms.
The isVisible() check in the tests is somewhat invalid now because it
is never immediately visible and I don't want to add a delay to unit
tests. I added a check that text() is not set for one test that was
only checking isVisible().
Addresses part of #1515.
Currently, the keyhint window is shown even if the keystring matches no
possible bindings. This causes an empty keyhint window to hang around
after entering hinting mode.
Instead, the window is now hidden if no bindings match the current
keystring.
Resolves#1507.
Change the unit tests to expect the new tabular format.
Also generally clean up the tests -- refactor from a class to
module-level functions as there was no need for a class here.
- validate keyhint text for a partial keychain
- ensure special keybindings are not suggested
- ensure it is not visible when disabled
- ensure changes to the suffix color are picked up
Otherwise we get:
import file mismatch:
imported module 'test_sessions' has this __file__ attribute:
/home/florian/proj/qutebrowser/git/tests/integration/features/test_sessions.py
which is not the same as the test file we want to collect:
/home/florian/proj/qutebrowser/git/tests/unit/misc/test_sessions.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
- qtbot.waitSignal with raising=True is the default this way, so we remove the
raising=True.
- qtbot.waitSignal with raising=False stay untouched
- Some qtbot.waitSignal without raising had one added (because we don't want it
to raise)
- Some qtbot.waitSignal without raising actually should've raised, which they
do now.
This patch attempts to fix an issue where an error occuring in
misc/guiprocess or the editor process crashing would delete the
temporary file thus making it impossible to recover changes not commited
to the form field from the editor.