Merge pull request #1283 from ZyX-I/fix-configuration-tests
When testing Vim do not rely on test order and do not save state Ref #1256
This commit is contained in:
commit
c0e5ef6710
|
@ -182,10 +182,17 @@ def select_renderer(simpler_renderer=False):
|
|||
renderer = EvenSimplerRenderer if simpler_renderer else SimpleRenderer
|
||||
|
||||
|
||||
def get_powerline_raw(helpers, PowerlineClass, **kwargs):
|
||||
def get_powerline_raw(helpers, PowerlineClass, replace_gcp=False, **kwargs):
|
||||
if not isinstance(helpers, TestHelpers):
|
||||
helpers = TestHelpers(helpers)
|
||||
select_renderer(kwargs.pop('simpler_renderer', False))
|
||||
|
||||
if replace_gcp:
|
||||
class PowerlineClass(PowerlineClass):
|
||||
@staticmethod
|
||||
def get_config_paths():
|
||||
return ['/']
|
||||
|
||||
pl = PowerlineClass(
|
||||
config_loader=TestConfigLoader(
|
||||
_helpers=helpers,
|
||||
|
|
|
@ -750,10 +750,10 @@ class TestVim(TestCase):
|
|||
def test_environ_update(self):
|
||||
# Regression test: test that segment obtains environment from vim, not
|
||||
# from os.environ.
|
||||
import tests.vim as vim_module
|
||||
with vim_module._with('globals', powerline_config_paths=['/']):
|
||||
from powerline.vim import VimPowerline
|
||||
import powerline as powerline_module
|
||||
import vim
|
||||
vim.vars['powerline_config_paths'] = ['/']
|
||||
with swap_attributes(config, powerline_module):
|
||||
with vim_module._with('environ', TEST='abc'):
|
||||
with get_powerline_raw(config, VimPowerline) as powerline:
|
||||
|
@ -769,7 +769,7 @@ class TestVim(TestCase):
|
|||
from powerline.vim import VimPowerline
|
||||
import powerline as powerline_module
|
||||
with swap_attributes(config, powerline_module):
|
||||
with get_powerline_raw(config, VimPowerline) as powerline:
|
||||
with get_powerline_raw(config, VimPowerline, replace_gcp=True) as powerline:
|
||||
powerline.add_local_theme('tests.matchers.always_true', {
|
||||
'segment_data': {
|
||||
'foo': {
|
||||
|
|
Loading…
Reference in New Issue