Commit Graph

507 Commits

Author SHA1 Message Date
Florian Bruhin
5689a3c0dc Fix unbinding default keys twice
When doing :unbind with a default keybinding the first time, it gets inserted
into bindings.commands with None as value.

When then doing :unbind a second time, instead of just leaving that None value
as-is, we removed it again (because it got treated as a custom binding).

Fixes #3162
2017-11-04 15:17:19 +01:00
Florian Bruhin
9a69ccc9e3 Merge remote-tracking branch 'origin/pr/3100' 2017-11-02 11:32:45 +01:00
Florian Bruhin
0b86b302a2 pylint: Turn off some more too-many-* stuff globally
Humans are just better at judging what's okay here than a machine.
2017-10-31 07:35:00 +01:00
lxhillwind
048b792c6f add <EOL> in :config-write-py generated file 2017-10-26 00:52:22 +08:00
Florian Bruhin
984dd1ba8c Fix remaining pylint/flake8 issues 2017-10-24 09:37:10 +02:00
siddhugolu
bc9d305354 modified as requested 2017-10-23 01:46:02 +05:30
siddhugolu
4862b2faf9 modified pylint pragmas 2017-10-22 23:52:35 +05:30
Luca Benci
8b91a74aef Fix broken test after default config change 2017-10-22 20:02:06 +02:00
Florian Bruhin
589e9b7153 Fix string escaping in config.source test 2017-10-20 10:05:42 +02:00
Luca Benci
937d0d0688 Add some more tests 2017-10-18 20:30:16 +02:00
Luca Benci
0d7a557396 Fix configtypes tests so that placeholder is True 2017-10-18 20:30:03 +02:00
Florian Bruhin
378498bbd7 Add a test for multiple config.source() errors 2017-10-18 14:06:54 +02:00
Florian Bruhin
5a9042ab3e Add a config.source() method 2017-10-18 13:53:26 +02:00
Luca Benci
06b990c0d1 Add ShellCommand tests for {file} 2017-10-17 23:03:42 +02:00
Florian Bruhin
d8384ced0a Show better error message when trying to toggle with :set 2017-10-17 06:26:42 +02:00
Florian Bruhin
2a65cadb67 Fix setting monospace fonts with None values
Fixes #3130
2017-10-16 06:18:09 +02:00
Florian Bruhin
27c46f20c0 Make sure the config default values are mutable
While the old values meant the same thing, they weren't mutable, so the config
couldn't modify them with a simple .append().

Fixes #3104
2017-10-14 16:40:44 +02:00
Florian Bruhin
4f870f902c Fix loading of monospace fonts in configtypes.QtFont
See #3096
2017-10-12 18:26:54 +02:00
Florian Bruhin
c87d369725 Improve fonts.monospace tests 2017-10-11 22:14:58 +02:00
Florian Bruhin
a21a60c5ca Fix updating fonts when fonts.monospace is changed
Fixes #2973
2017-10-11 22:14:55 +02:00
Florian Bruhin
cbe9ff7435 Fix reading of fonts.monospace on init
See #2973
2017-10-11 22:06:47 +02:00
Florian Bruhin
9c080538ba Add a setting to force the platform and improve Wayland handling
Closes #3078
See #2932
2017-10-11 09:23:21 +02:00
Florian Bruhin
bdc82bc633 Fix lint
See https://github.com/PyCQA/pylint/issues/1698
2017-10-11 08:41:23 +02:00
Florian Bruhin
2a3369e2fe Show nicer errors when trying to set deleted/renamed options 2017-10-11 08:00:38 +02:00
Florian Bruhin
0cd5d4300b Rename qt_args and force_software_rendering to add qt. prefix
Closes #3077
2017-10-11 07:45:38 +02:00
Florian Bruhin
abbd69f604 Implement deleting/renaming values in configdata.yml
This is needed for #3077, but also is used for the deletion in #2847 now.
See #2772.
2017-10-11 07:13:51 +02:00
Florian Bruhin
0e64511d63 Split up _init_envvars from configinit.early_init 2017-10-09 06:52:14 +02:00
Florian Bruhin
f63b95c298 Fix the window.hide_wayland_decoration setting
Fixes #2267
2017-10-09 06:50:29 +02:00
Florian Bruhin
36ef68c698 Add :bind --default
Closes #3059
2017-10-08 21:48:48 +02:00
Florian Bruhin
51ea56375e Improve error handling for config commands
- Use self._handle_config_error() for key commands too
- Catch getting an invalid key properly
- Remove (wrong) "set: " prefix
2017-10-08 14:40:10 +02:00
Florian Bruhin
c63d16e2ea tests: Get rid of duplicate key config stubs 2017-10-05 11:22:54 +02:00
Florian Bruhin
012f79b244 Make sure key_config_stub is available when needed 2017-10-05 11:05:16 +02:00
Florian Bruhin
712e4a975a Add a test to make sure :write-config-py files actually work 2017-10-05 10:48:14 +02:00
Florian Bruhin
3cb93b22ae Add tests for :config-write-py 2017-10-05 10:34:25 +02:00
Florian Bruhin
ade0e1bd0b Finish ConfigPyWriter and tests 2017-10-05 10:21:31 +02:00
Florian Bruhin
da4402e98c Don't rely on order in test_clear 2017-10-04 09:02:34 +02:00
Florian Bruhin
38270de120 Avoid configdata init in test_configinit
See #2777
2017-10-04 09:01:31 +02:00
Florian Bruhin
6037d44d0e Remove unused imports 2017-10-04 08:56:32 +02:00
Florian Bruhin
969b8f3200 Fix test_configcommands on Python 3.5
looks like assert_called_once() was introduced in 3.6
2017-10-04 08:55:33 +02:00
Florian Bruhin
37fa7a0d3e Fix casing in test name 2017-10-04 08:47:33 +02:00
Florian Bruhin
208b4d1cbc Make configfiles.YamlConfig iteration deterministic 2017-10-04 08:47:10 +02:00
Florian Bruhin
7cbb2b079f Use existing tabbed_browser_stubs fixture in tests 2017-10-04 06:35:42 +02:00
Florian Bruhin
22088d9f7b Remove --force for :bind and config.bind(...)
Turns out --force is just in the way for most people, and at least for default
bindings it's easy to reset them.

Also, it makes :config-source fail when config.py contains keybindings.

Closes #3049
2017-10-03 20:43:38 +02:00
Florian Bruhin
727580d1f4 Add a :config-edit command
See #2794
2017-10-03 20:43:38 +02:00
Florian Bruhin
8edaad51c3 Add a :config-source command
See #2794
2017-10-03 16:28:11 +02:00
Florian Bruhin
0695cfccfc Improve some configfile tests 2017-10-03 14:33:33 +02:00
Florian Bruhin
999d70ae40 Add missing config.py tests 2017-10-03 14:13:10 +02:00
Florian Bruhin
9383452ab9 Use a real YAML config for config tests 2017-10-03 13:06:50 +02:00
Florian Bruhin
ed8c3f4aa2 Add :config-clear and :config-unset
See #2794
2017-10-03 12:45:39 +02:00
Florian Bruhin
4ed60efa80 Add missing qapp fixture 2017-10-03 07:38:10 +02:00
Florian Bruhin
f533e3b751 Move config toggling to :config-cycle
This removes :set option! and allows :config-cycle option instead.
2017-10-03 07:38:10 +02:00
Florian Bruhin
81993a70a2 Split off :config-cycle from :set
Before, we allowed :set to take multiple values, which often lead to confusing
error messages when a user forgot to quote the value.

Now, we instead have a dedicated :config-cycle command for that.

See #1840, #2794
2017-10-03 07:37:55 +02:00
Florian Bruhin
fbf9817dcb Rename test classes 2017-10-02 07:15:00 +02:00
Florian Bruhin
a8fc561707 Split config commands off to their own file. 2017-10-02 07:08:30 +02:00
Florian Bruhin
a273baf8a0 Make sure :bind/unbind works properly when bindings.commands is None
To make this work, we should never return None when trying to get bindings to
modify.

Fixes #3026
2017-10-01 21:43:00 +02:00
Florian Bruhin
45db0eaccb Really force QtWebEngine for test_force_software_rendering init 2017-09-28 11:44:21 +02:00
Florian Bruhin
6c25e96621 Remove unused imports 2017-09-28 11:38:52 +02:00
Florian Bruhin
3be0a78819 Fix configinit tests 2017-09-28 11:05:53 +02:00
Florian Bruhin
35beb84e85 Fix tests and lint 2017-09-28 09:38:57 +02:00
Florian Bruhin
9607f3de59 Improve type documentation of settings
Use .get_name() for the docs
2017-09-27 08:25:52 +02:00
Florian Bruhin
c694bff902 Allow direct values for url.start_pages and content.user_stylesheets 2017-09-27 08:21:03 +02:00
Florian Bruhin
38449e3e2b Make sure the autoconfig.yml is saved periodically
Fixes #2982
2017-09-26 06:41:55 +02:00
Florian Bruhin
38038df703 Compare objects with :set with multiple values 2017-09-25 21:24:12 +02:00
Florian Bruhin
1086e31f28 Split up configinit tests 2017-09-25 21:24:12 +02:00
Florian Bruhin
6aed6bca93 Make loading autoconfig.yml opt-in when a config.py exists
This lets the user control the precedence those files should have, and also
simplifies the code quite a bit.

Fixes #2975
2017-09-25 21:24:12 +02:00
Florian Bruhin
40f0f75ad5 Improve error message for duplicate keys in config.py 2017-09-24 19:43:30 +02:00
Florian Bruhin
b8389e4496 Revert "Fix NUL byte error handling on Python 3.4"
This reverts commit a7d5a98cc4.
Not needed anymore now that we dropped support.
2017-09-22 22:30:02 +02:00
Florian Bruhin
e8ceeceac8 Fix mock check with Python 3.5
Looks like .assert_not_called() doesn't work on function mocks with 3.5.
2017-09-22 22:28:40 +02:00
Florian Bruhin
4e46c34e5a Use .assert_not_called() for mocks 2017-09-22 19:58:38 +02:00
Florian Bruhin
5be44756e3 Remove unused imports 2017-09-22 17:29:01 +02:00
Florian Bruhin
d5a1fff637 Move init stuff from config.py to configinit.py
Closes #2997
2017-09-22 14:11:54 +02:00
Florian Bruhin
501764d1cb Fix documented default values for falsey non-strings
Fixes #3015.
2017-09-22 13:18:27 +02:00
Florian Bruhin
7f8ae531aa Add config.configdir and config.datadir to config API.
Fixes #1419
2017-09-22 09:59:46 +02:00
Florian Bruhin
9b22480b07 Raise config.py errors happening in tests 2017-09-22 09:09:45 +02:00
Florian Bruhin
1dbd156c2f Simplify some config.py tests 2017-09-22 08:53:08 +02:00
Jay Kamat
43ce10efc3
Simplify and reorganize configfile tests
Also make save/load of sys.path a little more robust
2017-09-22 02:05:55 -04:00
Jay Kamat
4e22b4666d
Convert save-restore of sys to a context-manager
Also improve and simplify tests for save/load of sys.module and sys.path
2017-09-22 02:05:55 -04:00
Jay Kamat
7ddde334da
Add tests for module/path isolation 2017-09-22 02:05:55 -04:00
Florian Bruhin
64b783d9c0 Do not validate commands in the config and with :bind
There are just way too many gotchas related to valid modes, aliases, and
circular dependencies when validating aliases/bindings in the config.

Let's just remove this and let invalid commands fail late, when they're actually
used.
2017-09-21 22:30:48 +02:00
Florian Bruhin
32b2b3dfd9 Add test for invalid value type in YAML file 2017-09-21 21:15:37 +02:00
Florian Bruhin
b1ddb9a6df Remove confusing test
That's not the behavior we actually have in the config anymore when using
conf._yaml.load().
2017-09-21 20:27:45 +02:00
Florian Bruhin
691cd2d09b More test_configfiles cleanups 2017-09-21 20:19:02 +02:00
Florian Bruhin
3e0d49a4b3 Add TestYaml class to test_configfiles 2017-09-21 19:57:54 +02:00
Florian Bruhin
f821fb793a Initialize configdata in test_configfiles 2017-09-21 19:37:22 +02:00
Florian Bruhin
7cad8f41f2 Remove unknown YAML data from config
I considered introducing another list of deleted options (or a "deleted: True"
in configdata.yml), similar to what we had with the old config.

However, let's take the easier route and just delete everything we don't know
from configdata.yml. If someone edits it by hand, it's their fault :P

See #2772, #2847
2017-09-21 16:29:40 +02:00
Florian Bruhin
9a6de48efa Break long line 2017-09-21 09:12:25 +02:00
Florian Bruhin
fb33985f07 Merge remote-tracking branch 'origin/pr/2992' 2017-09-21 09:12:03 +02:00
Felix Van der Jeugt
6892705e18
cover setting-saving-loading-getting yaml config 2017-09-20 15:52:42 +02:00
Florian Bruhin
ef1c83862b Use utils.is_* for platform checks everywhere 2017-09-20 11:10:24 +02:00
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
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
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
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
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
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
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
215fd2f055 More test_config fixes/tests 2017-07-04 15:08:04 +02:00
Florian Bruhin
009ed3584d Reorder tests 2017-07-04 15:08:04 +02:00
Florian Bruhin
2b9b54cf6b Tests and improvements for ConfigContainer 2017-07-04 15:08:03 +02:00
Florian Bruhin
4495e721d8 Tests and fixes for config.Config 2017-07-04 15:08:03 +02:00
Florian Bruhin
07d0ea6a54 Unit tests and improvements for :bind/:unbind 2017-07-04 15:08:03 +02:00
Florian Bruhin
3edebce833 Add tests for :set 2017-07-04 15:08:03 +02:00
Florian Bruhin
31b999ea59 Tests and improvements for KeyConfig 2017-07-04 15:08:03 +02:00
Florian Bruhin
725ffef5f3 Use a real config object in unit tests 2017-07-04 15:08:03 +02:00
Florian Bruhin
a8c7e8ba05 Add first config tests 2017-07-04 15:08:03 +02:00
Florian Bruhin
28670f8e48 Move config.style into config.config and refactor it 2017-07-04 15:08:03 +02:00
Florian Bruhin
81d6406e14 Update test_stylesheet 2017-07-04 15:08:03 +02:00
Florian Bruhin
a5c8a52dd5 Update config_stub for tests 2017-07-04 15:08:03 +02:00
Florian Bruhin
0dc95aceed Clean up old test_config.py 2017-07-04 15:08:03 +02:00
Florian Bruhin
065f82f485 Fix endless recursion while validating aliases 2017-07-04 15:08:03 +02:00
Florian Bruhin
441b3a4df4 Allow missing fixed_keys for configtypes.Dict
We just fill them up with a None value for the value type, so we can e.g. only
specify a subset of modes for bindings and the rest is {}.
2017-07-04 15:08:03 +02:00
Florian Bruhin
9d8b76e497 Simplify _none_value for List/Dict configtypes
We don't need to check for fixed_keys/required_keys in get_obj (only get_py),
and we don't need to care about mutability in get_py.
2017-07-04 15:08:03 +02:00
Florian Bruhin
da0a2b8578 Handle {} and [] with none_ok for configtypes.Dict/List 2017-07-04 15:08:03 +02:00
Florian Bruhin
2ba637891a Add required_keys for configtypes.Dict 2017-07-04 15:08:03 +02:00
Florian Bruhin
7ee222af88 Return [] for none-values for configtypes.List 2017-07-04 15:08:03 +02:00
Florian Bruhin
9cbacf3264 Use {} for none-dicts and fix keybindings 2017-07-04 15:08:03 +02:00
Florian Bruhin
127db2fe42 Be a bit more relaxed about values for Perc
We now allow float/int for objects, and strings without a trailing % sign.
2017-07-04 15:08:03 +02:00
Florian Bruhin
9bd438618a Add a test for DuplicateKeyError 2017-07-04 15:08:03 +02:00
Florian Bruhin
2a40401398 Fix config tests for new Command type 2017-07-04 15:08:03 +02:00
Florian Bruhin
383968d948 Add a Key config type
Make sure any key we get from the config is normalized).
2017-07-04 15:08:02 +02:00
Florian Bruhin
bc8176ff21 Remove most legacy config code 2017-07-04 15:08:02 +02:00
Florian Bruhin
f5d2c48bbb Fix new keyconfig issues 2017-07-04 15:08:02 +02:00
Florian Bruhin
dc74a55b84 Fix remaining configtypes issues 2017-07-04 15:08:02 +02:00
Florian Bruhin
3392ccc58b test_configtypes fixes 2017-07-04 15:08:02 +02:00
Florian Bruhin
ecba175b16 Test and fix configtypes to_str. 2017-07-04 15:08:02 +02:00
Florian Bruhin
d69c6d0c66 Reorganize how configtypes store their data
Now the "object" kind of value (like in YAML) is stored internally, and that's
the canonical value. The methods changed their meaning slightly, see the
docstring in configtypes.py for details.
2017-07-04 15:08:02 +02:00
Florian Bruhin
1cbb4ece4b Force configtype.Dict keys to be strings 2017-07-04 15:08:02 +02:00
Florian Bruhin
41655e7852 Fix handling of none_ok in List/Dict
We now always return None (and '' as string) when the user configured an empty
list or dict.
2017-07-04 15:08:01 +02:00
Florian Bruhin
8ea3d92697 Initial implementation of to_str for configtypes 2017-07-04 15:08:01 +02:00
Florian Bruhin
fede64ba7a Add test for configdata.is_valid_prefix 2017-07-04 15:08:01 +02:00
Florian Bruhin
18eb133811 configdata: Make sure default values are valid 2017-07-04 15:08:01 +02:00
Florian Bruhin
0857a45b0a configtypes: parse regex flags properly 2017-07-04 15:08:01 +02:00
Florian Bruhin
001312ca82 Disallow Booleans for configtypes.Int.from_py 2017-07-04 14:42:56 +02:00
Florian Bruhin
4e729bb9ec Back to using json in test_configtypes
It returns one-line data and is YAML compatible
2017-07-04 14:42:56 +02:00
Florian Bruhin
dfee857466 Make utils.yaml_dump return str 2017-07-04 14:42:56 +02:00
Florian Bruhin
05dc94ccc4 Improve configtypes tests 2017-07-04 14:42:56 +02:00
Florian Bruhin
7416164aca Rename old validate tests 2017-07-04 14:42:56 +02:00
Florian Bruhin
71f2e8c577 None validation fixups for test_configtypes 2017-07-04 14:42:56 +02:00
Florian Bruhin
61ba92ae18 configtypes: Separate str/py basic validation
This also ensures the behavior for none_ok is consistent.
2017-07-04 14:42:56 +02:00
Florian Bruhin
cdbd64a30d Move test_configtypes_hypothesis to test_configtypes 2017-07-04 14:42:56 +02:00
Florian Bruhin
7e7fbf106b Fix lint and old config options 2017-07-04 14:42:56 +02:00