Commit Graph

3501 Commits

Author SHA1 Message Date
Felix Van der Jeugt
285b534384
make changed dirty and save on duplicate write 2017-09-20 10:04:34 +02:00
Florian Bruhin
55cbb39127 Merge remote-tracking branch 'origin/pr/2999' 2017-09-20 08:48:22 +02:00
Florian Bruhin
a519d54e7d Remove hypothesis strict setting
It was deprecated as normal python warnings are used now
2017-09-20 08:17:04 +02:00
Florian Bruhin
54ceb52eaf Switch to using Item.get_report() for vulture 2017-09-20 08:17:04 +02:00
Florian Bruhin
22be2bf7ab Fix circular import in ImportFake in test_version
We can't use importlib.import_module() when we patched that away...
2017-09-20 08:17:04 +02:00
Ryan Farley
dd4294de03 fix #2979: use dictionary for mutable tracking
Using a dictionary instead of a list keeps only one working copy,
allowing consistency in between calls of update_mutables()
2017-09-19 16:26:02 -05:00
Florian Bruhin
3a5241b642 Start using attrs
Closes #1073
2017-09-19 22:21:45 +02:00
Ryan Farley
cc540bb166 Merge branch 'master' into mutable-dict 2017-09-19 14:07:46 -05:00
Ryan Farley
83473b9c69 fix test for new tuples 2017-09-19 14:00:44 -05:00
Felix Van der Jeugt
8db630d358
don't copy values but set dirty 2017-09-19 17:26:03 +02:00
Felix Van der Jeugt
7b192d426e
add unit test and fix issues with it 2017-09-19 15:30:28 +02:00
Florian Bruhin
7226750363 Bump up Hypothesis deadline globally 2017-09-19 15:08:56 +02:00
Florian Bruhin
bb073e1709 Bump up another hypothesis deadline 2017-09-19 13:38:44 +02:00
Florian Bruhin
248afde21e configapi: Also allow mode as posarg 2017-09-19 13:18:44 +02:00
Florian Bruhin
e8ae672c93 Check for read errors in test_configfiles 2017-09-19 13:18:16 +02:00
Florian Bruhin
7d1549aaeb Make mode optionally in ConfigAPI.bind and .unbind 2017-09-19 13:14:41 +02:00
Florian Bruhin
a23492fe27 Bump up hypothesis deadline for Content-Disposition test 2017-09-19 11:16:03 +02:00
Florian Bruhin
51afe14965 Set backend to QtWebKit in cookie tests 2017-09-19 11:07:11 +02:00
Florian Bruhin
55a4eb18f2 Get rid of httpbin
Fixes #2949
2017-09-19 10:35:54 +02:00
Florian Bruhin
e9b8288e4b Add a test for Config._set_value without backend 2017-09-19 07:08:56 +02:00
Florian Bruhin
13a8867e13 Add tests for config.get_backend() 2017-09-19 07:05:36 +02:00
Florian Bruhin
7bece81519 Make sure tests always have object.backend set 2017-09-19 06:46:08 +02:00
Florian Bruhin
8ae87bbde2 Remove typing module from version.py
It comes with python now
2017-09-18 23:06:49 +02:00
Florian Bruhin
3772dc5930 Drop legacy QtWebKit support
See #2742
2017-09-18 23:01:17 +02:00
Florian Bruhin
3e70bf5af9 Make sure we never compare against an uninit'ed backend 2017-09-18 23:01:17 +02:00
Florian Bruhin
5298d14084 Move backend initialization to config.py 2017-09-18 23:01:17 +02:00
Florian Bruhin
505321c336 Drop support for Python 3.4
See #2742
2017-09-18 23:01:17 +02:00
Florian Bruhin
852baaa8c3 Drop support for Qt < 5.7.1
See #2742
2017-09-18 23:01:17 +02:00
Florian Bruhin
66e4c3286a Fix lint 2017-09-17 22:53:32 +02:00
Florian Bruhin
fe05947b54 Add a new qt_args setting
See #2589
2017-09-17 22:53:27 +02:00
Florian Bruhin
4c616a5733 Move all documentation files to doc/ 2017-09-17 21:27:38 +02:00
Florian Bruhin
3e0ca5d94d Stop using objreg for state-config 2017-09-17 21:04:34 +02:00
Florian Bruhin
70b8585e95 Move qtutils.unset_organization to standarddir 2017-09-17 20:44:08 +02:00
Florian Bruhin
f40103cbba Don't require qapp for configtypes tests anymore
We need to make sure they work without a QApplication, and the only reason they
needed one before was standarddir.
2017-09-17 20:38:34 +02:00
Ryan Farley
b35a808712 test multiple mutations for config
This detects the problem in #2979
2017-09-17 13:24:05 -05:00
Florian Bruhin
6f1b8bd1d9 Make sure the config is available before the QApplication
See #2589
2017-09-17 20:06:35 +02:00
Florian Bruhin
21a10fcb17 Break up long line 2017-09-17 16:33:37 +02:00
Florian Bruhin
e4d05e3fec Log error information when config init fails 2017-09-17 14:13:36 +02:00
Florian Bruhin
62b30af12a Fix unit tests for end2end SQL change 2017-09-17 11:49:42 +02:00
Florian Bruhin
f85f4630ff Turn off SQL history writing during end2end tests
This hopefully makes them a bit faster, and also should help with weird hangs we
had in tests.
2017-09-17 10:58:30 +02:00
Florian Bruhin
f6d878f33f Mark window.open test as flaky 2017-09-17 10:36:28 +02:00
Florian Bruhin
f29bafcdb2 Fix expected dir on macOS 2017-09-17 10:35:05 +02:00
Florian Bruhin
7ed64efa08 Fix standarddir.cache() on Windows 2017-09-17 10:35:05 +02:00
Florian Bruhin
b31db0d0d5 Add another str() for paths
Using py.path for os.path is only supported since 3.6
2017-09-17 09:49:06 +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
df9726a152 Fix standarddir without AppDataLocation 2017-09-17 09:49:06 +02:00
Florian Bruhin
9354297276 Add test for standarddir without QApplication
See #2791.
2017-09-16 23:48:06 +02:00
Florian Bruhin
9706dcbda5 Fix lint 2017-09-16 23:48:02 +02:00
Florian Bruhin
a1fa40f067 Remove the ability to migrate old QtWebEngine data
Versions before v0.9.0 (which didn't even support hinting with QtWebEngine!)
used to write QtWebEngine data to:

~/.local/share/qutebrowser/qutebrowser/QtWebEngine/Default
~/.cache/qutebrowser/qutebrowser/QtWebEngine/Default

In v0.9.0 this was changed to:

~/.local/share/qutebrowser/webengine
~/.cache/qutebrowser/webengine

Now we don't try to migrate data from the old location anymore.
2017-09-16 23:48:02 +02:00
Florian Bruhin
a85e19a5e1 Add initial support for early standarddir init
See #2589, #2791
2017-09-16 23:47:22 +02:00
Florian Bruhin
624c3a4c27 Merge branch 'new-config' 2017-09-16 16:12:21 +02:00
Florian Bruhin
0aa85f5967 Skip SSL download test if SSL is not supported
This makes the testsuite pass entirely with a PyPI PyQt and OpenSSL 1.1
2017-09-16 10:43:59 +02:00
Florian Bruhin
3179e8c7b9 Always autoescape jinja environments unless overridden
We were only rendering .html files before, so the old _guess_autoescape function
had the effect of always autoescaping .render() (from a file) but never
autoescaping .from_string(). However, most places using .from_string() actually
render (Qt-)HTML via jinja, so they should escape stuff!

Now, we always autoescape, except when the caller uses the
jinja.environment.no_autoescape() context manager, which places rendering
stylesheets now do.

This impacted:

- Confirm quit texts (no HTML here)
- config.py loading errors
  (where this was found because of an error containing - a <keybinding>)
- Certificate error prompts
  (should be fine from what I can tell, as the only user-controllable output is
  the hostname, which cannot contain HTML)
2017-09-16 10:43:59 +02:00
Florian Bruhin
c8f3743008 Remove auto_save.config setting
This is not needed anymore now that we have config.load_autoconfig=False and
wasn't even read anywhere.
2017-09-15 22:22:09 +02:00
Florian Bruhin
4f6e085be8 Quote a completed value if it contains " 2017-09-15 22:17:38 +02:00
Florian Bruhin
a7d5a98cc4 Fix NUL byte error handling on Python 3.4
Looks like Python 3.4 raises TypeError and not ValueError...
2017-09-15 22:17:38 +02:00
Florian Bruhin
d901bee88e Fix test_oserror on older Pythons 2017-09-15 22:17:38 +02:00
Florian Bruhin
42039eee99 Fully remove ConfigAPI.val 2017-09-15 19:01:03 +02:00
Florian Bruhin
3be7299cb4 Fix completions for FlagList 2017-09-15 18:41:08 +02:00
Florian Bruhin
2e8419db27 Fix lint 2017-09-15 17:24:39 +02:00
Florian Bruhin
c9625cb311 Add more tests for YAML error handling 2017-09-15 17:21:11 +02:00
Florian Bruhin
3f8817cc2d Use blocking message boxes for config errors 2017-09-15 17:21:11 +02:00
Florian Bruhin
745ef63451 Start implementing autoconfig.yml error handling 2017-09-15 17:21:11 +02:00
Florian Bruhin
3d3391b55e Clean up *_tmpdir fixtures 2017-09-15 14:32:03 +02:00
Florian Bruhin
fa4ea912c9 Get rid of init_standarddir fixture
Instead, always patch in tmpdir's so we don't write to qute_test folders.
2017-09-15 14:30:46 +02:00
Florian Bruhin
e87a782411 Move command-history init to cmdhistory.py 2017-09-15 14:27:15 +02:00
Florian Bruhin
54214873f4 Resurrect :debug-cache-stats test 2017-09-15 14:16:42 +02:00
Florian Bruhin
54dfc083f9 Remove default_config fixture 2017-09-15 14:13:27 +02:00
Florian Bruhin
9f955f251a Reshape comments 2017-09-15 14:11:45 +02:00
Florian Bruhin
e0621c6eda Fix initializing without a config.py 2017-09-15 14:08:37 +02:00
Florian Bruhin
f406e8d9ca Remove config.val support for config.py 2017-09-15 14:08:37 +02:00
Florian Bruhin
25baf3b97e Add more tests for config.py error handling 2017-09-15 13:30:09 +02:00
Florian Bruhin
5efce10c2c Add initial tests for config.py error handling 2017-09-15 12:07:54 +02:00
Florian Bruhin
4da9b8c495 check_coverage: Truncate long floats 2017-09-15 12:07:54 +02:00
Florian Bruhin
c5c566aadc tests: Bump up timeout for CallbackChecker 2017-09-15 12:07:54 +02:00
Florian Bruhin
b8fb88f4c2 Improve config error handling
- Errors are now combined if possible
- Rich text output in message boxes
- ConfigContainer errors are collected properly
2017-09-15 12:07:54 +02:00
Florian Bruhin
490de32b49 Initial attempt at error handling for config.py 2017-09-14 21:51:29 +02:00
Florian Bruhin
5a11c96e56 Don't fail tests because of OpenSSL 1.1 warnings
"Downloading with SSL errors" from downloads.feature still fails, but like this,
at least all other tests pass without the need to modify LD_LIBRARY_PATH.
2017-09-14 18:23:40 +02:00
Florian Bruhin
b3734b151b Handle mutations in config.py correctly 2017-09-14 17:38:33 +02:00
Florian Bruhin
cb806aefa3 Initial config.py support
See #2795
2017-09-14 17:38:33 +02:00
Florian Bruhin
ed6933a839 tests: Ignore "Invalid node channel message" log from Chromium 2017-09-14 16:15:07 +02:00
Florian Bruhin
0a3a1b756d Mark confirm_quit test to only run on Windows
See #2964
2017-09-14 16:14:01 +02:00
Florian Bruhin
6618c3a6e8 Don't use shlex for configtypes.ShellCommand
We accidentally did show the command as a list in to_str(). However, after
correcting that to use shlex.escape, we got ugly qutebrowser command lines
when tabbing to the default value, because of how shlex handles double-escaping:

>>> print(shlex.quote("gvim -f '{}'"))
'gvim -f '"'"'{}'"'"''

While in this case, outputting "gvim -f '{}'" would be much more appropriate, it
doesn't look like we can teach shlex.quote to do that.

Instead, we now only accept a list as input for ShellCommand, at the price that
the user needs to do
  :set editor.command '["gvim", "-f", "{}"]'
instead of
  :set editor.command 'gvim -f {}'

Fixes #2962.
2017-09-14 14:44:24 +02:00
Florian Bruhin
12260e068a Don't move cache directory on Windows 2017-09-14 13:35:42 +02:00
Florian Bruhin
5cd14c941b Fix race condition is :jseval test 2017-09-14 09:33:58 +02:00
Florian Bruhin
0de7b2eb83 Skip standarddir migrations when a basedir is given 2017-09-14 00:37:54 +02:00
Florian Bruhin
3dc67df180 Fix minor standarddir migration issues 2017-09-14 00:37:54 +02:00
Florian Bruhin
d1e69a75dd tests: Ignore some more Mac Mini messages 2017-09-14 00:37:54 +02:00
Florian Bruhin
cee51df4fb Refactor JS log handling and use a dict for javascript.log
Fixes #2828
2017-09-14 00:37:01 +02:00
Florian Bruhin
1fc9817cd4 Remove support for ambiguous keybindings 2017-09-14 00:37:01 +02:00
Florian Bruhin
9d95dec5ea Handle standarddir.config() correctly on macOS
With auto=False we should get ~/.qutebrowser
2017-09-13 21:32:36 +02:00
Florian Bruhin
08b5fc8e3b Stabilize qute://plainlog test
Looks like we actually get a loading event on Qt 5.9 just fine, and there was a
race condition here otherwise.
2017-09-13 21:32:36 +02:00
Florian Bruhin
70a9a7e5c8 Fix macOS testsuite issues 2017-09-13 21:32:36 +02:00
Florian Bruhin
231193f7a6 Fix standarddir test coverage 2017-09-13 21:32:36 +02:00
Florian Bruhin
2f394d3c9f Mock out all moving functions for standarddir.init() 2017-09-13 21:32:36 +02:00
Florian Bruhin
50aab7a802 Skip tests needing AppDataLocation on older Qt versions 2017-09-13 21:32:22 +02:00
Florian Bruhin
f7d17c4c55 Allow existing empty dir when migrating files
Remove old empty directory if it exists - otherwise, we move old/data to
new/data/data.
2017-09-13 21:32:22 +02:00
Florian Bruhin
0498e042a0 Ignore another macOS log line 2017-09-13 21:32:22 +02:00
Florian Bruhin
e84c1fa82f Call _init_config in test_fake_mac_auto_config 2017-09-13 21:32:22 +02:00
Florian Bruhin
2a9441dfbf Make moving data in standarddir more generic 2017-09-13 21:32:22 +02:00
Florian Bruhin
8c4bc76de6 Stabilize hint test which failed on macOS 2017-09-13 17:26:56 +02:00
Florian Bruhin
ad2598b475 Add initial support for standarddir.config(auto=True)
This doesn't actually migrate things yet.
See #2791, #383.
2017-09-13 17:26:56 +02:00
Florian Bruhin
a2f16dbecd Merge standarddir.system_data() into standarddir.data(system=True)
See #2791
2017-09-13 17:26:56 +02:00
Florian Bruhin
2d500d4efa Also don't create ~/Downloads in standarddir.downloads()
This means we need to create it in downloads.py instead.

Fixes #2418
2017-09-13 17:26:56 +02:00
Florian Bruhin
91f5e72f02 Remove download dir from path info
This always returns the default Qt path (e.g. ~/Downloads) and also creates it
each time.

See #2418
2017-09-13 17:26:56 +02:00
Florian Bruhin
b185e57406 Remove change_qapp_name in test_standarddir
This is already done in conftest.py anyways
2017-09-13 17:26:56 +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
Florian Bruhin
56b673ca05 tests: Don't use <Ctrl+Backspace> to clear qute://settings fields
This won't work on macOS
2017-09-13 10:29:54 +02:00
Florian Bruhin
5d50ec612d Disable qsettings subdir test on macOS
QSettings uses a plist file there.
2017-09-13 10:21:23 +02:00
Florian Bruhin
73ea316501 Use upper-case Monospace in test_progress_affecting_statusbar_height
While the test worked again with eb4691adfc, it
broke again immediately because of 40ee89bddc.

With that fix in, the lower-case monospace in the set value was immediately
replaced by the full list of fonts again. With an upper-case Monospace, this
won't happen.

Fixes #2825, for real this time.
2017-09-12 22:51:52 +02:00
Florian Bruhin
b04a233e8d Adjust :unbind signature to match :bind 2017-09-12 22:51:52 +02:00
Florian Bruhin
eb4691adfc Fix test_progress_affecting_statusbar_height on Windows
Fixes #2825
2017-09-12 22:12:37 +02:00
Florian Bruhin
40ee89bddc Initialize monospace fonts in tests properly
See #2825
2017-09-12 22:12:37 +02:00
Florian Bruhin
9bcd120dcc Only mark completion issue as flaky 2017-09-11 19:33:27 +02:00
Florian Bruhin
f6a0500bd3 Merge branch 'master' into new-config
This pulls the travis changes to drop the old Qt 5.2 environment.
2017-09-11 18:39:41 +02:00
Florian Bruhin
a65d70820a Add macOS xfail for session completion test
See #2956
2017-09-11 18:33:08 +02:00
Florian Bruhin
50d43b0678 Fix some macOS testsuite issues 2017-09-11 18:33:08 +02:00
Florian Bruhin
2538fec0c5 Ignore Mach IPC message 2017-09-11 18:33:08 +02:00
Florian Bruhin
f320da07b4 Increase timeout for test_version 2017-09-11 18:33:07 +02:00
Florian Bruhin
9e10f891ff Print output earlier in test_version 2017-09-11 18:32:23 +02:00
Florian Bruhin
9a8088586f tests: Ignore dbus-uuidgen error messages 2017-09-11 18:32:23 +02:00
Florian Bruhin
1491f20201 Remove geolocation tests
They just cause more trouble than they're worth.
2017-09-11 18:32:23 +02:00
Florian Bruhin
b4f30f6df2 Move coverage to QtWebEngine environment with PyPI-PyQt 2017-09-11 18:30:23 +02:00
Florian Bruhin
a283a1bb65 Merge branch 'master' into new-config 2017-09-09 10:52:02 +02:00
Ryan Roden-Corrent
a6d14ad7dc Fix two new-config/master merge resolutions.
Remove icon from jinja.render call (removed in master).
Add 'When the unwritable dir is unwritable' to download feature file.
2017-09-07 08:58:55 -04:00
Ryan Roden-Corrent
63e0574411 Remove stray FIXME:conf 2017-09-07 07:32:46 -04:00
Ryan Roden-Corrent
a5ecb75fcd Really avoid flakiness in test_models.
Ensure the OrderedDict is actually ordered consistently.
2017-09-05 07:52:42 -04:00
Ryan Roden-Corrent
fc02216754 Avoid flakiness in test_models.
Ensure config values are ordered consistently by using an OrderedDict.
2017-09-04 16:30:54 -04:00
Ryan Roden-Corrent
0d78c72018 Remove config dependency from get_cmd_completions.
In order to really resolve the python3.4 circular import, this should
take the completion info as an argument and not depend on the config
module.
2017-09-04 15:00:35 -04:00
Ryan Roden-Corrent
3bfa01f0d0 Pass CompletionInfo to completion functions.
In python3.4, there is a circular dependency between the config module
and configmodel.bind. This is resolved by dependency injection. The
config/keyconfig instances are embedded in a struct passed to every
completion function, so the functions no longer depend on the modules.

This will also enable completion functions to access other previously
inaccessible info, such as the window id.
See #2814.
2017-09-04 14:01:48 -04:00
Ryan Roden-Corrent
6a292f9d56 Merge quteurls.feature into qutescheme.feature. 2017-08-28 07:18:14 -04:00
Florian Bruhin
79d3c49f26 Merge pull request #2909 from jgkamat/jay/fix-2900
Fix saving a session with --only-active-window
2017-08-28 07:58:25 +02:00
Ryan Roden-Corrent
61a03a7808 Add quteurls.feature
Move Scenario: Open qute://version from misc.feature to quteurls.feature
See #2779.
2017-08-27 22:37:04 -04:00
Ryan Roden-Corrent
b89caf0458 Use REPLACE when rebuilding completion table.
When upgrading from an old table that used different url formatting, two
entries might map to the same key, so we'll need to replace the previous
entry to avoid a primary key conflict.
2017-08-23 21:26:27 -04:00
Ryan Roden-Corrent
d35b47c9d8 Regenerate history completion on version change.
Incrementing _USER_VERSION in the source will cause the
HistoryCompletion table to regenerate when users update.

This is currently necessary to support some recent formatting fixes, but
could be incremented again in the future for other changes.
2017-08-21 08:45:40 -04:00
Ryan Roden-Corrent
111846a909 Merge remote-tracking branch 'upstream/master' into configmerge 2017-08-20 21:18:47 -04:00
Ryan Roden-Corrent
722137ab29 Fix 2 end2end tests for config/completion merge. 2017-08-20 21:15:25 -04:00
Ryan Roden-Corrent
b5a6583559 Fix pylint/flake8/vulture errors. 2017-08-20 21:12:38 -04:00
Ryan Roden-Corrent
90c49b3fe7 Move bind completion to configmodels.
When in miscmodels, the config module was unable to find the function.
It appears to be some sort of circular import issue:

```
  File "/home/rcorre/projects/contrib/qutebrowser/qutebrowser/app.py", line 44, in <module>
    from qutebrowser.completion.models import miscmodels
  File "/home/rcorre/projects/contrib/qutebrowser/qutebrowser/completion/models/miscmodels.py", line 24, in <module>
    from qutebrowser.completion.models import completionmodel, listcategory, util
  File "/home/rcorre/projects/contrib/qutebrowser/qutebrowser/completion/models/util.py", line 24, in <module>
    from qutebrowser.config import config
  File "/home/rcorre/projects/contrib/qutebrowser/qutebrowser/config/config.py", line 223, in <module>
    class ConfigCommands:
  File "/home/rcorre/projects/contrib/qutebrowser/qutebrowser/config/config.py", line 314, in ConfigCommands
    @cmdutils.argument('command', completion=miscmodels.bind)
AttributeError: module 'qutebrowser.completion.models.miscmodels' has no attribute 'bind'
```

As configmodel imports util (and thereby config as well) it is unclear
to me why moving bind() to configmodel actually fixes this, but it does.
2017-08-20 21:12:38 -04:00
Ryan Roden-Corrent
0286e9ddf2 Fix completion tests after config merge. 2017-08-20 21:12:38 -04:00
Ryan Roden-Corrent
5f45b9b40e Fix pylint and coverage for history. 2017-08-20 20:59:48 -04:00
Ryan Roden-Corrent
8c6133e29d Regenerate history completion table if needed.
If the HistoryCompletion table is removed, regenerate it from the
History table. This allows users to manually edit History, then remove
HistoryCompletion to prompt regeneration.

See #2903.
2017-08-18 07:39:36 -04:00
Jay Kamat
7073c33dce
Test for saving a session with --only-active-window 2017-08-17 22:27:40 -04:00
Ryan Roden-Corrent
c607537319 Consistently format urls in history.
Encode urls that are inserted into the history, but do not encode urls
for completion (other than removing passwords).
Also ensure that urls read from the history text file are formatted
consistenly with those added while browsing.

Fixes #2903.
2017-08-14 21:37:43 -04:00
Ryan Roden-Corrent
5ea420b49b Fix startup crashes after config merge.
Get qutebrowser to the point where it can at least start

- Declare _messages earlier in MessageView.__init__ so it is set before
  the config trigger tries to access it.
- Remove unused configmodel completion functions
- Move bind completion to configmodel to avoid a circular import with
  the config module
- Fix some config accesses (forgot to use .val)
- Fix old Completion.CompletionKind references
2017-08-09 07:28:22 -04:00
Florian Bruhin
3a2d64ba46 version.distribution(): Handle Funtoo 2017-08-08 20:19:33 +02: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
6e025c1bb0 Don't perform alphabetical sort in listcategory.
Instead, expect the data to be given in the desired order. Completion
functions should sort their data _if_ they want it sorted in the
completion. This has a few implications:

- {book,quick}marks appear in the same order they do in the text file.
  This means users can rearrange their mark files for custom sorting.
  Fixes #2354
- Sessions are sorted as they appear in the session manager
- Tabs are sorted numerically, not alphabetically (Fixes #2883)

Note that prefix-based filter sorting is still performed, so items
starting with the filter pattern come first.
2017-08-06 10:00:18 -04:00
Florian Bruhin
49b858e359 Add more variants of fake apple URL to ignored ones 2017-08-01 16:00:53 +02:00
Florian Bruhin
695769d1b4 Merge pull request #2875 from rcorre/obsolete-signals
Remove obsolete signals.
2017-07-29 20:30:25 +02:00
Florian Bruhin
ba92ea9fb4 Merge pull request #2873 from rcorre/completion-del-marks
Support delete from :{quick,book}mark-load.
2017-07-29 19:27:25 +02: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
Ryan Roden-Corrent
1ab7bb83cc Support delete from :{quick,book}mark-load.
Pressing ctrl-d in the completion menu for
:quickmark-load/:bookmark-load  will now delete the selected
quickmark/bookmark.

Resolves #2840.
2017-07-29 12:49:20 -04:00
Ryan Roden-Corrent
c6cb6ccd07 Fix fetch/delete sql category bug.
Fixes #2868, where pressing <shift-tab> then <ctrl-d> in history
completion (with > 256 items) would cause later items to disappear (and
cause a crash if you try to delete again).

Cause:
Scrolling to the bottom would fetch an additional 256 items (in addition
to the 256 that are fetched at first). Deleting causes the query to
re-run, but it only fetches the initial 256 items, so the current index
is now invalid.

Fix:
After deleting from the history category, call fetchMore until it has
enough rows populated that the current index is valid.
2017-07-28 09:07:30 -04:00
Florian Bruhin
8f63bb1edc Merge pull request #2853 from rcorre/fix-completionview
Expand history completion results if on last index.
2017-07-27 12:31:01 +02:00
Florian Bruhin
a942613d7f Use ctypes instead of PyOpenGL for QtWebEngine Nvidia workaround
Fixes #2821
2017-07-27 09:22:12 +02:00
Ryan Roden-Corrent
32fa1ff1e9 Expand history completion results if on last index.
When tabbing to the last index of history completion, call expandAll
which will call fetchMore to retrieve more query results, if available.

Calling fetchMore directly will not update the view, and for some
reason self.expand(idx.parent()) and
self.expand(self.model().index(idx.row(), 0)) did not work, so I'm using
expandAll.

Fixes #2841.
2017-07-26 07:46:12 -04:00
Ryan Roden-Corrent
1929883485 Fix bind completion for bindings with arguments.
When a key is bound to a command line that includes one or more
arguments to a command, bind completion should show the whole command
for the "Current" category, and use only the command name to look up the
description.

Fixes #2859, where a crash was caused by looking up the description by
the full command text rather than just the name.
2017-07-25 12:55:44 -04:00
Florian Bruhin
5ecda25fdb Fix renderer process test for older Qt versions 2017-07-25 17:35:42 +02:00
Florian Bruhin
792a01ba6d Try to stabilize renderer process test 2017-07-25 16:56:38 +02:00
Ryan Roden-Corrent
f09423efe5 Abort resizeEvent if model is None.
Some reports came in that a resizeEvent was causing a crash due to the
model being none in the CompletionView.

Fixes #2854.
2017-07-24 08:16:14 -04:00
Florian Bruhin
07b2fde2de Mark test_version as flaky
Sometimes it fails on Travis with empty output for no apparent reason
2017-07-24 08:05:51 +02:00
Florian Bruhin
df3ba278e9 Merge pull request #2852 from rcorre/fix-max-items
Fix web-history-max-items-crash.
2017-07-24 07:29:15 +02:00
Florian Bruhin
837ee5c626 Merge pull request #2846 from rcorre/completion-fixes
Completion fixes
2017-07-24 07:27:11 +02:00
Ryan Roden-Corrent
2ad4cdd729 Fix web-history-max-items-crash.
Fixes #2849, where pressing 'o' with web-history-max-items set and no
history items would cause a crash as the query result is empty.
2017-07-23 21:17:22 -04:00
Ryan Roden-Corrent
ff9efe22ae Fix unused imports and removeRow override.
Override removeRows instead of removeRow.

> removeRow is not virtual in C++, so if this gets called by Qt
> internally for some reason, it wouldn't use the overloaded version -
> so I think it'd be better to implement removeRows and then use
> removeRow without overloading that

- The-Compiler
2017-07-23 17:30:09 -04:00
Florian Bruhin
56b4989f44 Fix tests for QProcess changes 2017-07-23 22:10:50 +02:00
Ryan Roden-Corrent
b61691684e Clear selection when setting completion pattern.
It doesn't make sense to have an active selection while you are
filtering by entering text. You should be in one of two states:

1. Tabbing through completions (valid selection)
2. Entering a filter pattern (invalid selection)

Fixes #2843, where a crash would occur after the following:

1. tab to an item other than the first
2. <backspace>
3. re-type last character
4. <ctrl-d>

This would try to delete an out of range index.
2017-07-22 18:06:16 -04:00
Ryan Roden-Corrent
bc21904fef Fix completion-item-del on undeletable item.
Even though no item was deleted, it was manipulating the completion
model because beginRemoveRows was called before the exception was
raised.

This fixes that problem by moving the removal logic (and delete_func
check) into the parent model, so it can check whether deletion is
possible before calling beginRemoveRows.

Fixes #2839.
2017-07-22 17:16:35 -04:00
Florian Bruhin
118a7942a5 Add maximum bound for web-history-max-items
sqlite can't handle values bigger than uint64_t for LIMIT.
2017-07-21 18:30:12 +02:00
Florian Bruhin
544094ba72 Use simpler way of preventing History completion 2017-07-21 17:55:47 +02:00
Florian Bruhin
6660297871 Fix new completion with web-history-max-items set to 0
We get no last_atime limit at all otherwise:

qutebrowser.misc.sql.SqlException: Failed to prepare query "SELECT url, title,
strftime('%Y-%m-%d', last_atime, 'unixepoch', 'localtime') FROM
CompletionHistory WHERE (url LIKE :pat escape '\' or title LIKE :pat escape '\')
AND last_atime >= ORDER BY last_atime DESC": "near "ORDER": syntax error Unable
to execute statement"
2017-07-21 17:11:38 +02:00
Florian Bruhin
fba25338be Merge pull request #2295 from rcorre/really_complete
Completion refactor V3
2017-07-21 15:05:43 +02:00
Ryan Roden-Corrent
0eb347186c Add 'localtime' to sql history query.
We need to tell sqlite to convert the timestamps to localtime during
formatting, otherwise it formats them as though you are in UTC.

Also fix up a few uses of mktime.
2017-07-20 09:06:29 -04:00
Florian Bruhin
0f85898137 Add a config version to the YAML file 2017-07-19 08:22:00 +02:00
Ryan Roden-Corrent
c32d452786 Add LIMIT to history query.
For performance, re-introduce web-history-max-items.
As the history query has now become a very specific multi-part query and
history completion was the only consumer of SqlCategory, SqlCategory is
now replaced by a HistoryCategory class.
2017-07-16 18:13:51 -04:00
Florian Bruhin
cbf9da0b7e Set window.navigator.languages correctly 2017-07-13 21:24:17 +02:00
Ryan Roden-Corrent
8745f80d90 Fix qute://history SQL bug.
The javascript history page was requesting the new start_time in ms, but
the python code was expecting seconds. This is fixed by removing all the
millisecond translations in the python code and only translating to
milliseconds in the javascript code that formats dates.
2017-07-13 08:54:21 -04:00
Ryan Roden-Corrent
1aed2470e5 SQL code review.
- Fix flake8
- history.clear should also clear completion table
- call _resize_columns in set_model, not set_pattern
- add more unit-testing for the history completion table
2017-07-12 22:14:27 -04:00
Ryan Roden-Corrent
ea459a1eca SQL code review fixes.
- Ignore invalid variable name in flake8 (pylint already checks this and
  we don't want to have to double-ignore)
- Fix and test completion bug with `:set asdf `
- Remove unused import
- Use `assert not func.called` instead of `func.assert_not_called` for
  backwards compatibility
2017-07-12 08:19:31 -04:00
Ryan Roden-Corrent
182d067ff8 SQL code review fixes.
- Fix comment and empty line check in _parse_entry
- connect layoutAboutToBeChanged signal
- assert sort_order is None if sort_by is None
- modify sql init failure message to ask about Qt sqlite support.
2017-07-11 08:07:48 -04:00
Florian Bruhin
1e58c87380 Improve test for messageview timeout 2017-07-11 09:25:53 +02:00
Florian Bruhin
a91e6c3405 Fix test_adblock on Windows
We can't simply have an absolute filename as URL path there, so we only deal
with paths relative to tmpdir in the URLs now.
2017-07-10 22:22:44 +02:00
Florian Bruhin
237362663a Fix test_configfiles.test_init on Windows 2017-07-10 20:37:36 +02:00
Florian Bruhin
ac8fb03b80 Fix lint 2017-07-10 20:37:30 +02:00
Yashar Shahi
a631c971d9 Add tests for show messages longer
Add tests for "Show messages longer if there are multiple of them."
2017-07-10 20:52:42 +04:30
Florian Bruhin
135fb042da Make settings from qute://settings persistent 2017-07-10 18:04:39 +02:00
Florian Bruhin
e81dcccace Add a test for a None currentWidget with backforward widget 2017-07-10 09:29:45 +02:00
Florian Bruhin
5fb6cb713b Hide back/forward widget when there's no text 2017-07-10 07:59:56 +02:00
Florian Bruhin
0e8175b8eb Update docstrings/docs 2017-07-09 23:27:34 +02:00
Daniel Hahler
b3a9e09d6c Add statusline widget for back/forward indicator
Fixes https://github.com/qutebrowser/qutebrowser/issues/2737.
2017-07-09 22:38:44 +02:00
Florian Bruhin
bb567a61b6 Fix ipc test coverage 2017-07-09 22:09:31 +02:00
Florian Bruhin
84c2289aa5 Merge branch 'master' of https://github.com/iordanisg/qutebrowser 2017-07-09 12:56:52 +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
915cd5f016 Fix long lines 2017-07-09 11:51:22 +02:00
Ryan Roden-Corrent
cf4ac1a5b7 SQL code review changes.
- use mocker.Mock instead of mock.Mock to avoid an extra import
- attach model to validator sooner so it can validate changes in the
  model during the test
2017-07-08 16:34:38 -04:00
Iordanis Grigoriou
c9fd182dba Adjust suggested_fn_from_title, add tests 2017-07-08 16:28:58 +02:00
Ryan Roden-Corrent
f9f8900fe9 More sql code review fixes.
- remove outdated comment
- fix sql init error message
- clean up history text import code
- fix test_history file path in coverage check
- use real web history, not stub, for completion model tests
- use qtmodeltester in sql/list_category tests
- test url encoding in history tests
- fix test_clear by using a callable mock
- remove test_debug_dump_history_oserror as the check is now the same as
  for the file not existing
- rename nonempty to data in test_completionmodel
- add more delete_cur_item tests
- test empty option/value completion
2017-07-08 09:57:32 -04:00
Florian Bruhin
ad615941a2 Replace OS X with macOS 2017-07-08 11:12:43 +02:00
Ryan Roden-Corrent
515e82262d Merge remote-tracking branch 'upstream/master' into really_complete 2017-07-07 20:42:21 -04:00
Florian Bruhin
215503ba59 Remove now useless suppression 2017-07-07 15:21:18 +02:00
Iordanis Grigoriou
82d194cf2e Improve function docstring, add more tests 2017-07-06 21:37:11 +02:00
Iordanis Grigoriou
3bfafb5e50 Refactor suggested_fn_from_title, add unit tests 2017-07-06 17:41:54 +02:00
Florian Bruhin
338d62204e Make TestModuleVersions in test_version more maintainable 2017-07-06 12:36:11 +02:00
Florian Bruhin
66168a5b49 Add test ids to test_version_output 2017-07-06 12:25:11 +02:00
Florian Bruhin
911e59b0f4 Improve version output without SSL support 2017-07-06 12:23:08 +02:00
Florian Bruhin
94951d92a1 Simplify arg handling in test_version_output 2017-07-06 12:15:42 +02:00
Iordanis Grigoriou
57e4d4978b Use page title only for whitelisted extensions 2017-07-06 11:59:02 +02:00
Ryan Roden-Corrent
dc4472470e Merge remote-tracking branch 'upstream/master' into really_complete 2017-07-05 08:45:57 -04:00
Ryan Roden-Corrent
81f5b7115f Add spec=[] to two mock functions in tests. 2017-07-05 08:44:56 -04:00
Florian Bruhin
28410b8533 Release v0.11.0 2017-07-04 18:02:34 +02:00
Florian Bruhin
45b1285402 Merge pull request #2765 from jgkamat/jay/tab-crashes
Refactor set_tab_pinned to take a tab widget.
2017-07-04 17:24:10 +02:00
Florian Bruhin
0cdd3ff82f Update some more references to old config options 2017-07-04 16:46:02 +02:00
Florian Bruhin
770c879410 Bring back searchengine BDD tests 2017-07-04 15:39:07 +02:00
Florian Bruhin
cff61fa0bc Fix pylint
This also reverts commit 8df0b063be.
2017-07-04 15:34:10 +02:00
Florian Bruhin
88b878098d Implement pretty-printing of configtypes for the doc
This is also needed to make the docs environment work on Travis - as otherwise,
doc generation wasn't deterministic because of changing dict key order.
2017-07-04 15:09:23 +02:00
Florian Bruhin
f98b8a240e Fix flake8 2017-07-04 15:09:23 +02:00
Florian Bruhin
acf85eb96b Stabilize qute://settings test 2017-07-04 15:09:23 +02:00
Florian Bruhin
79c11d6008 Skip test_configdata.test_init_benchmark on Travis in Docker
See #2777
2017-07-04 15:09:23 +02:00
Florian Bruhin
65585b313d test_configtypes: Rename test_to_py to _valid for consistency 2017-07-04 15:09:23 +02:00
Florian Bruhin
9ac2dbcc80 Disallow surrogate escapes in dicts and lists in the config
In Dict.to_str() and List.to_str() we use json.dump to get a value. However,
JSON includes surrogate escapes in the dumped values, which breaks round trips.

>>> yaml.load(json.dumps({'\U00010000': True}))
{'\ud800\udc00': True}

>>> yaml.load(json.dumps({'\U00010000': True}, ensure_ascii=False))
yaml.reader.ReaderError: unacceptable character #x10000: special characters are not allowed

See:
https://stackoverflow.com/a/38552626/2085149
https://news.ycombinator.com/item?id=12798032
2017-07-04 15:09:23 +02:00
Florian Bruhin
fa0f4e1101 Improve test_configtypes.TestDict
We didn't have to_py tests there before.
2017-07-04 15:09:23 +02:00
Florian Bruhin
f00e91e85e Don't set valid_values in test_configtypes.TestList
Most of the time we want to check values without them being outright rejected by
ValidValues.
2017-07-04 15:09:23 +02:00
Florian Bruhin
05f4f2e742 Fix TestDict.test_hypothesis_text for unordered dicts 2017-07-04 15:09:23 +02:00
Florian Bruhin
ea2b9f5596 Remove old comment
The recursion is caught in test_config
2017-07-04 15:09:15 +02:00
Florian Bruhin
0528a800f2 Fix config things relying on dict order 2017-07-04 15:08:04 +02:00
Florian Bruhin
8933b4c5da Avoid calling configdata.init() in tests
It takes unnecessary time (20ms without C extensions) to initialize it over and
over again - and for some reason, it takes 20s (!) on Travis.
2017-07-04 15:08:04 +02:00
Florian Bruhin
9db4a8cb43 Clean up test_cache 2017-07-04 15:08:04 +02:00
Florian Bruhin
9dfe4429d7 Import qutebrowser.app in conftest 2017-07-04 15:08:04 +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
4bebfd8d5f Update test_modeparsers for new config 2017-07-04 15:08:04 +02:00
Florian Bruhin
d5cd0b19b0 Update test_basekeyparser for new config 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
1663280f53 Update test_shared for new config
Also, make accept_language none_ok=True like it was in the old configdata.py
2017-07-04 15:08:04 +02:00
Florian Bruhin
7dd5e4b2e6 Skip broken completion tests
This skips test_completer and test_models - we'll reintroduce them when merging
the new completion.
2017-07-04 15:08:04 +02:00
Florian Bruhin
ff05560047 Update test_adblock for new config
This required some changes on how URLs are handled during those tests. Before,
we simply could return a path and (since we had a patched QNAM), nobody
complained.

Now this actually needs to be a valid URL, so we use
https://www.example.com/path everywhere instead.
2017-07-04 15:08:04 +02:00
Florian Bruhin
78d7ac311f Use fonts.monospace properly 2017-07-04 15:08:04 +02:00
Florian Bruhin
a36f5bafc1 Rename content.javascript.can_*_windows to _tabs 2017-07-04 15:08:04 +02:00
Florian Bruhin
5ada3606d8 Allow to not send the DNT header 2017-07-04 15:08:04 +02:00
Florian Bruhin
202b8445f6 Move content.accept_language under headers 2017-07-04 15:08:04 +02:00
Florian Bruhin
8712fc6fd3 Move new_instance_open_target out of url.
It doesn't really fit there really...
See 3cf028db23cbfe256e499d8881c3c2856f224d94
2017-07-04 15:08:04 +02:00
Florian Bruhin
d641652a92 More test_config improvements 2017-07-04 15:08:04 +02:00
Florian Bruhin
c214acd899 Remove config from objreg 2017-07-04 15:08:04 +02:00
Florian Bruhin
f8a88ae042 Clean up objreg properly in config tests 2017-07-04 15:08:04 +02:00
Florian Bruhin
54adf3898a Add test_configfiles.py 2017-07-04 15:08:04 +02:00
Florian Bruhin
1a492e9f4a Re-add backend checks to new config 2017-07-04 15:08:04 +02:00
Florian Bruhin
556f49d367 Add PACFetcher.fetch
Let's not try to download proxies during tests...
2017-07-04 15:08:04 +02:00
Florian Bruhin
215fd2f055 More test_config fixes/tests 2017-07-04 15:08:04 +02:00