Commit Graph

256 Commits

Author SHA1 Message Date
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
5298d14084 Move backend initialization to config.py 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
3e0ca5d94d Stop using objreg for state-config 2017-09-17 21:04:34 +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
Florian Bruhin
6f1b8bd1d9 Make sure the config is available before the QApplication
See #2589
2017-09-17 20:06:35 +02:00
Florian Bruhin
e4d05e3fec Log error information when config init fails 2017-09-17 14:13:36 +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
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
e87a782411 Move command-history init to cmdhistory.py 2017-09-15 14:27:15 +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
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
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
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
5d50ec612d Disable qsettings subdir test on macOS
QSettings uses a plist file there.
2017-09-13 10:21:23 +02:00
Florian Bruhin
b04a233e8d Adjust :unbind signature to match :bind 2017-09-12 22:51:52 +02:00
Ryan Roden-Corrent
b5a6583559 Fix pylint/flake8/vulture errors. 2017-08-20 21:12:38 -04:00
Ryan Roden-Corrent
71b71dbc58 Merge remote-tracking branch 'upstream/master' into HEAD 2017-08-06 18:13:49 -04:00
Florian Bruhin
0f85898137 Add a config version to the YAML file 2017-07-19 08:22:00 +02:00
Florian Bruhin
237362663a Fix test_configfiles.test_init on Windows 2017-07-10 20:37:36 +02:00
Florian Bruhin
28410b8533 Release v0.11.0 2017-07-04 18:02:34 +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
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
9dfe4429d7 Import qutebrowser.app in conftest 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
d641652a92 More test_config improvements 2017-07-04 15:08:04 +02:00