Avoid explicit config monkeypatching
This commit is contained in:
parent
787e3db3d5
commit
052c527e4c
@ -80,25 +80,23 @@ class TestCompletions:
|
|||||||
|
|
||||||
"""Tests for completions.use_best_match."""
|
"""Tests for completions.use_best_match."""
|
||||||
|
|
||||||
def test_dont_use_best_match(self, config_stub, monkeypatch):
|
def test_dont_use_best_match(self, config_stub):
|
||||||
"""Test multiple completion options with use_best_match set to false.
|
"""Test multiple completion options with use_best_match set to false.
|
||||||
|
|
||||||
Should raise NoSuchCommandError
|
Should raise NoSuchCommandError
|
||||||
"""
|
"""
|
||||||
config_stub.val.completion.use_best_match = False
|
config_stub.val.completion.use_best_match = False
|
||||||
monkeypatch.setattr('qutebrowser.config', config_stub)
|
|
||||||
parser = runners.CommandParser(partial_match=True)
|
parser = runners.CommandParser(partial_match=True)
|
||||||
|
|
||||||
with pytest.raises(cmdexc.NoSuchCommandError):
|
with pytest.raises(cmdexc.NoSuchCommandError):
|
||||||
result = parser.parse('do')
|
result = parser.parse('do')
|
||||||
|
|
||||||
def test_use_best_match(self, config_stub, monkeypatch):
|
def test_use_best_match(self, config_stub):
|
||||||
"""Test multiple completion options with use_best_match set to true.
|
"""Test multiple completion options with use_best_match set to true.
|
||||||
|
|
||||||
The resulting command should be the best match
|
The resulting command should be the best match
|
||||||
"""
|
"""
|
||||||
config_stub.val.completion.use_best_match = True
|
config_stub.val.completion.use_best_match = True
|
||||||
monkeypatch.setattr('qutebrowser.config', config_stub)
|
|
||||||
parser = runners.CommandParser(partial_match=True)
|
parser = runners.CommandParser(partial_match=True)
|
||||||
|
|
||||||
result = parser.parse('do')
|
result = parser.parse('do')
|
||||||
|
Loading…
Reference in New Issue
Block a user