mirror of
https://github.com/powerline/powerline.git
synced 2025-07-25 06:46:33 +02:00
Fix errors reported by linter, allow running it during tests
This commit is contained in:
parent
2fd04348f7
commit
01585edeab
@ -7,6 +7,8 @@ from shutil import rmtree
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from powerline.lib import mergedicts_copy as mdc
|
from powerline.lib import mergedicts_copy as mdc
|
||||||
|
from subprocess import check_call
|
||||||
|
from operator import add
|
||||||
|
|
||||||
|
|
||||||
CONFIG_DIR = 'tests/config'
|
CONFIG_DIR = 'tests/config'
|
||||||
@ -25,8 +27,8 @@ root_config = lambda: {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
'spaces': 0,
|
'spaces': 0,
|
||||||
'interval': 0,
|
'interval': None,
|
||||||
'watcher': 'test',
|
'watcher': 'auto',
|
||||||
},
|
},
|
||||||
'ext': {
|
'ext': {
|
||||||
'test': {
|
'test': {
|
||||||
@ -117,6 +119,14 @@ class WithConfigTree(object):
|
|||||||
renderer_module='tests.lib.config_mock',
|
renderer_module='tests.lib.config_mock',
|
||||||
**self.p_kwargs
|
**self.p_kwargs
|
||||||
)
|
)
|
||||||
|
if os.environ.get('POWERLINE_RUN_LINT_DURING_TESTS'):
|
||||||
|
try:
|
||||||
|
check_call(['scripts/powerline-lint'] + reduce(add, (
|
||||||
|
['-p', d] for d in self.p.get_config_paths()
|
||||||
|
)))
|
||||||
|
except:
|
||||||
|
self.__exit__()
|
||||||
|
raise
|
||||||
return self.p.__enter__(*args)
|
return self.p.__enter__(*args)
|
||||||
|
|
||||||
def __exit__(self, *args):
|
def __exit__(self, *args):
|
||||||
@ -172,7 +182,7 @@ class TestMerging(TestCase):
|
|||||||
with WithConfigTree(mdc(main_tree(), {
|
with WithConfigTree(mdc(main_tree(), {
|
||||||
'2/config': {
|
'2/config': {
|
||||||
'common': {
|
'common': {
|
||||||
'spaces': 3,
|
'spaces': 1,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'3/config': {
|
'3/config': {
|
||||||
@ -185,7 +195,7 @@ class TestMerging(TestCase):
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
})) as p:
|
})) as p:
|
||||||
self.assertRenderEqual(p, '{12} bt {2-}>>{--}')
|
self.assertRenderEqual(p, '{12} bt {2-}>>{--}')
|
||||||
|
|
||||||
def test_colors_config_merging(self):
|
def test_colors_config_merging(self):
|
||||||
with WithConfigTree(mdc(main_tree(), {
|
with WithConfigTree(mdc(main_tree(), {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user