mirror of
https://github.com/powerline/powerline.git
synced 2025-07-23 22:05:43 +02:00
Move Python tests.* modules to tests/modules, rename tests/path
This commit is contained in:
parent
2a1aef1bac
commit
c30383a194
@ -1,11 +0,0 @@
|
|||||||
# vim:fileencoding=utf-8:noet
|
|
||||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
if sys.version_info < (2, 7):
|
|
||||||
from unittest2 import TestCase, main # NOQA
|
|
||||||
from unittest2.case import SkipTest # NOQA
|
|
||||||
else:
|
|
||||||
from unittest import TestCase, main # NOQA
|
|
||||||
from unittest.case import SkipTest # NOQA
|
|
11
tests/modules/__init__.py
Normal file
11
tests/modules/__init__.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# vim:fileencoding=utf-8:noet
|
||||||
|
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if sys.version_info < (2, 7):
|
||||||
|
from unittest2 import TestCase, main # NOQA
|
||||||
|
from unittest2.case import SkipTest # NOQA
|
||||||
|
else:
|
||||||
|
from unittest import TestCase, main # NOQA
|
||||||
|
from unittest.case import SkipTest # NOQA
|
@ -12,7 +12,7 @@ from powerline.renderer import Renderer
|
|||||||
from powerline.lib.config import ConfigLoader
|
from powerline.lib.config import ConfigLoader
|
||||||
from powerline import Powerline, get_default_theme
|
from powerline import Powerline, get_default_theme
|
||||||
|
|
||||||
from tests.lib import Args, replace_attr
|
from tests.modules.lib import Args, replace_attr
|
||||||
|
|
||||||
|
|
||||||
UT = get_default_theme(is_unicode=True)
|
UT = get_default_theme(is_unicode=True)
|
||||||
@ -175,7 +175,7 @@ def get_powerline(config, **kwargs):
|
|||||||
TestPowerline,
|
TestPowerline,
|
||||||
_helpers=helpers,
|
_helpers=helpers,
|
||||||
ext='test',
|
ext='test',
|
||||||
renderer_module='tests.lib.config_mock',
|
renderer_module='tests.modules.lib.config_mock',
|
||||||
logger=Logger(),
|
logger=Logger(),
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
@ -59,7 +59,7 @@ class FSTree(object):
|
|||||||
self.p = TestPowerline(
|
self.p = TestPowerline(
|
||||||
_paths=self.get_config_paths(self.root),
|
_paths=self.get_config_paths(self.root),
|
||||||
ext='test',
|
ext='test',
|
||||||
renderer_module='tests.lib.config_mock',
|
renderer_module='tests.modules.lib.config_mock',
|
||||||
**self.p_kwargs
|
**self.p_kwargs
|
||||||
)
|
)
|
||||||
if os.environ.get('POWERLINE_RUN_LINT_DURING_TESTS'):
|
if os.environ.get('POWERLINE_RUN_LINT_DURING_TESTS'):
|
@ -13,7 +13,7 @@ import pexpect
|
|||||||
|
|
||||||
from powerline.lib.unicode import u
|
from powerline.lib.unicode import u
|
||||||
|
|
||||||
from tests.lib.vterm import VTerm, Dimensions
|
from tests.modules.lib.vterm import VTerm, Dimensions
|
||||||
|
|
||||||
|
|
||||||
class MutableDimensions(object):
|
class MutableDimensions(object):
|
@ -13,8 +13,8 @@ else:
|
|||||||
|
|
||||||
from powerline.commands.main import get_argparser, finish_args
|
from powerline.commands.main import get_argparser, finish_args
|
||||||
|
|
||||||
from tests import TestCase
|
from tests.modules import TestCase
|
||||||
from tests.lib import replace_attr
|
from tests.modules.lib import replace_attr
|
||||||
|
|
||||||
|
|
||||||
class TestParser(TestCase):
|
class TestParser(TestCase):
|
||||||
@ -140,5 +140,5 @@ class TestParser(TestCase):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
0
tests/test_commandt_plugin.vim
Executable file → Normal file
0
tests/test_commandt_plugin.vim
Executable file → Normal file
@ -11,8 +11,8 @@ from shutil import rmtree
|
|||||||
from powerline.lib.dict import mergedicts_copy as mdc
|
from powerline.lib.dict import mergedicts_copy as mdc
|
||||||
from powerline import Powerline
|
from powerline import Powerline
|
||||||
|
|
||||||
from tests import TestCase
|
from tests.modules import TestCase
|
||||||
from tests.lib.config_mock import select_renderer, UT
|
from tests.modules.lib.config_mock import select_renderer, UT
|
||||||
|
|
||||||
|
|
||||||
CONFIG_DIR = 'tests/config'
|
CONFIG_DIR = 'tests/config'
|
||||||
@ -139,7 +139,7 @@ class WithConfigTree(object):
|
|||||||
select_renderer(simpler_renderer=True)
|
select_renderer(simpler_renderer=True)
|
||||||
self.p = TestPowerline(
|
self.p = TestPowerline(
|
||||||
ext='test',
|
ext='test',
|
||||||
renderer_module='tests.lib.config_mock',
|
renderer_module='tests.modules.lib.config_mock',
|
||||||
**self.p_kwargs
|
**self.p_kwargs
|
||||||
)
|
)
|
||||||
if os.environ.get('POWERLINE_RUN_LINT_DURING_TESTS'):
|
if os.environ.get('POWERLINE_RUN_LINT_DURING_TESTS'):
|
||||||
@ -266,5 +266,5 @@ class TestMerging(TestCase):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
@ -5,8 +5,8 @@ from time import sleep
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
from tests import TestCase
|
from tests.modules import TestCase
|
||||||
from tests.lib.config_mock import get_powerline, add_watcher_events, UT
|
from tests.modules.lib.config_mock import get_powerline, add_watcher_events, UT
|
||||||
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
@ -315,5 +315,5 @@ class TestConfigReload(TestCase):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
@ -7,11 +7,12 @@ import os
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
import tests.vim as vim_module
|
import tests.modules.vim as vim_module
|
||||||
|
|
||||||
from tests import TestCase
|
from tests.modules import TestCase
|
||||||
from tests.lib.config_mock import get_powerline, get_powerline_raw, swap_attributes, UT
|
from tests.modules.lib.config_mock import (get_powerline, get_powerline_raw,
|
||||||
from tests.lib import Args, replace_item
|
swap_attributes, UT)
|
||||||
|
from tests.modules.lib import Args, replace_item
|
||||||
|
|
||||||
|
|
||||||
def highlighted_string(s, group, **kwargs):
|
def highlighted_string(s, group, **kwargs):
|
||||||
@ -797,7 +798,6 @@ class TestVim(TestCase):
|
|||||||
def test_environ_update(self):
|
def test_environ_update(self):
|
||||||
# Regression test: test that segment obtains environment from vim, not
|
# Regression test: test that segment obtains environment from vim, not
|
||||||
# from os.environ.
|
# from os.environ.
|
||||||
import tests.vim as vim_module
|
|
||||||
with vim_module._with('globals', powerline_config_paths=['/']):
|
with vim_module._with('globals', powerline_config_paths=['/']):
|
||||||
from powerline.vim import VimPowerline
|
from powerline.vim import VimPowerline
|
||||||
import powerline as powerline_module
|
import powerline as powerline_module
|
||||||
@ -817,7 +817,7 @@ class TestVim(TestCase):
|
|||||||
import powerline as powerline_module
|
import powerline as powerline_module
|
||||||
with swap_attributes(config, powerline_module):
|
with swap_attributes(config, powerline_module):
|
||||||
with get_powerline_raw(config, VimPowerline, replace_gcp=True) as powerline:
|
with get_powerline_raw(config, VimPowerline, replace_gcp=True) as powerline:
|
||||||
powerline.add_local_theme('tests.matchers.always_true', {
|
powerline.add_local_theme('tests.modules.matchers.always_true', {
|
||||||
'segment_data': {
|
'segment_data': {
|
||||||
'foo': {
|
'foo': {
|
||||||
'contents': '“bar”'
|
'contents': '“bar”'
|
||||||
@ -840,7 +840,7 @@ class TestVim(TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'path')))
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'vim_sys_path')))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
@ -873,5 +873,5 @@ class TestLemonbar(TestRender):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
0
tests/test_empty_encoding.old.vim
Executable file → Normal file
0
tests/test_empty_encoding.old.vim
Executable file → Normal file
@ -15,8 +15,8 @@ from powerline.lib.dict import updated
|
|||||||
from powerline.bindings.tmux import get_tmux_version
|
from powerline.bindings.tmux import get_tmux_version
|
||||||
from powerline import get_fallback_logger
|
from powerline import get_fallback_logger
|
||||||
|
|
||||||
from tests.lib.terminal import (ExpectProcess, MutableDimensions,
|
from tests.modules.lib.terminal import (ExpectProcess, MutableDimensions,
|
||||||
do_terminal_tests, get_env)
|
do_terminal_tests, get_env)
|
||||||
|
|
||||||
|
|
||||||
VTERM_TEST_DIR = os.path.abspath('tests/vterm_tmux')
|
VTERM_TEST_DIR = os.path.abspath('tests/vterm_tmux')
|
||||||
|
@ -11,8 +11,8 @@ from subprocess import check_call
|
|||||||
from glob import glob1
|
from glob import glob1
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
|
|
||||||
from tests.lib.terminal import (ExpectProcess, MutableDimensions,
|
from tests.modules.lib.terminal import (ExpectProcess, MutableDimensions,
|
||||||
do_terminal_tests, get_env)
|
do_terminal_tests, get_env)
|
||||||
|
|
||||||
|
|
||||||
VTERM_TEST_DIR = os.path.abspath('tests/vterm_vim')
|
VTERM_TEST_DIR = os.path.abspath('tests/vterm_vim')
|
||||||
|
@ -21,8 +21,8 @@ from powerline.lib.shell import run_cmd
|
|||||||
|
|
||||||
import powerline.lib.unicode as plu
|
import powerline.lib.unicode as plu
|
||||||
|
|
||||||
from tests.lib import Pl, replace_attr
|
from tests.modules.lib import Pl, replace_attr
|
||||||
from tests import TestCase, SkipTest
|
from tests.modules import TestCase, SkipTest
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -736,5 +736,5 @@ class TestVCS(TestCase):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
@ -5,8 +5,8 @@ import os
|
|||||||
|
|
||||||
from powerline.lib.config import ConfigLoader
|
from powerline.lib.config import ConfigLoader
|
||||||
|
|
||||||
from tests import TestCase
|
from tests.modules import TestCase
|
||||||
from tests.lib.fsconfig import FSTree
|
from tests.modules.lib.fsconfig import FSTree
|
||||||
|
|
||||||
|
|
||||||
FILE_ROOT = os.path.join(os.path.dirname(__file__), 'cfglib')
|
FILE_ROOT = os.path.join(os.path.dirname(__file__), 'cfglib')
|
||||||
@ -48,5 +48,5 @@ class TestLoaderCondition(TestCase):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
@ -3,8 +3,8 @@ from __future__ import (unicode_literals, division, absolute_import, print_funct
|
|||||||
|
|
||||||
import powerline.listers.i3wm as i3wm
|
import powerline.listers.i3wm as i3wm
|
||||||
|
|
||||||
from tests.lib import Args, replace_attr, Pl
|
from tests.modules.lib import Args, replace_attr, Pl
|
||||||
from tests import TestCase
|
from tests.modules import TestCase
|
||||||
|
|
||||||
|
|
||||||
class TestI3WM(TestCase):
|
class TestI3WM(TestCase):
|
||||||
@ -223,5 +223,5 @@ class TestI3WM(TestCase):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
0
tests/test_local_overrides.vim
Executable file → Normal file
0
tests/test_local_overrides.vim
Executable file → Normal file
@ -14,8 +14,8 @@ from shutil import rmtree
|
|||||||
|
|
||||||
from powerline import finish_common_config, create_logger
|
from powerline import finish_common_config, create_logger
|
||||||
|
|
||||||
from tests import TestCase
|
from tests.modules import TestCase
|
||||||
from tests.lib import replace_attr
|
from tests.modules.lib import replace_attr
|
||||||
|
|
||||||
|
|
||||||
TIMESTAMP_RE = r'\d{4}-\d\d-\d\d \d\d:\d\d:\d\d,\d{3}'
|
TIMESTAMP_RE = r'\d{4}-\d\d-\d\d \d\d:\d\d:\d\d,\d{3}'
|
||||||
@ -463,5 +463,5 @@ def tearDownModule():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
0
tests/test_nerdtree_plugin.vim
Executable file → Normal file
0
tests/test_nerdtree_plugin.vim
Executable file → Normal file
0
tests/test_plugin_file.vim
Executable file → Normal file
0
tests/test_plugin_file.vim
Executable file → Normal file
@ -9,10 +9,10 @@ import os
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import tests.vim as vim_module
|
import tests.modules.vim as vim_module
|
||||||
|
|
||||||
from tests.lib import Args, urllib_read, replace_attr
|
from tests.modules.lib import Args, urllib_read, replace_attr
|
||||||
from tests import TestCase
|
from tests.modules import TestCase
|
||||||
|
|
||||||
from powerline import NotInterceptedError
|
from powerline import NotInterceptedError
|
||||||
from powerline.segments.common import wthr
|
from powerline.segments.common import wthr
|
||||||
@ -101,7 +101,7 @@ class TestVimConfig(TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'path')))
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'vim_sys_path')))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
@ -197,5 +197,5 @@ def tearDownModule():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
@ -13,10 +13,11 @@ from powerline.segments import shell, tmux, pdb, i3wm
|
|||||||
from powerline.lib.vcs import get_fallback_create_watcher
|
from powerline.lib.vcs import get_fallback_create_watcher
|
||||||
from powerline.lib.unicode import out_u
|
from powerline.lib.unicode import out_u
|
||||||
|
|
||||||
import tests.vim as vim_module
|
import tests.modules.vim as vim_module
|
||||||
|
|
||||||
from tests.lib import Args, urllib_read, replace_attr, new_module, replace_module_module, replace_env, Pl
|
from tests.modules.lib import (Args, urllib_read, replace_attr, new_module,
|
||||||
from tests import TestCase, SkipTest
|
replace_module_module, replace_env, Pl)
|
||||||
|
from tests.modules import TestCase, SkipTest
|
||||||
|
|
||||||
|
|
||||||
def get_dummy_guess(**kwargs):
|
def get_dummy_guess(**kwargs):
|
||||||
@ -1598,7 +1599,7 @@ class TestVim(TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'path')))
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'vim_sys_path')))
|
||||||
from powerline.segments import vim
|
from powerline.segments import vim
|
||||||
cls.vim = vim
|
cls.vim = vim
|
||||||
from powerline.segments.common import vcs
|
from powerline.segments.common import vcs
|
||||||
@ -1672,5 +1673,5 @@ def tearDownModule():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
@ -6,10 +6,10 @@ import sys
|
|||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
import tests.vim as vim_module
|
import tests.modules.vim as vim_module
|
||||||
|
|
||||||
from tests.lib import Pl
|
from tests.modules.lib import Pl
|
||||||
from tests import TestCase
|
from tests.modules import TestCase
|
||||||
|
|
||||||
|
|
||||||
class TestVim(TestCase):
|
class TestVim(TestCase):
|
||||||
@ -22,7 +22,7 @@ class TestVim(TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'path')))
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'vim_sys_path')))
|
||||||
from powerline.selectors import vim
|
from powerline.selectors import vim
|
||||||
cls.vim = vim
|
cls.vim = vim
|
||||||
|
|
||||||
@ -32,5 +32,5 @@ class TestVim(TestCase):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
0
tests/test_tabline.vim
Executable file → Normal file
0
tests/test_tabline.vim
Executable file → Normal file
@ -13,7 +13,7 @@ from powerline.lib.watcher.uv import UvNotFound
|
|||||||
from powerline import get_fallback_logger
|
from powerline import get_fallback_logger
|
||||||
from powerline.lib.monotonic import monotonic
|
from powerline.lib.monotonic import monotonic
|
||||||
|
|
||||||
from tests import TestCase, SkipTest
|
from tests.modules import TestCase, SkipTest
|
||||||
|
|
||||||
|
|
||||||
INOTIFY_DIR = 'inotify' + os.path.basename(os.environ.get('PYTHON', ''))
|
INOTIFY_DIR = 'inotify' + os.path.basename(os.environ.get('PYTHON', ''))
|
||||||
@ -241,5 +241,5 @@ def tearDownModule():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from tests import main
|
from tests.modules import main
|
||||||
main()
|
main()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# vim:fileencoding=utf-8:noet
|
# vim:fileencoding=utf-8:noet
|
||||||
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
from __future__ import (unicode_literals, division, absolute_import, print_function)
|
||||||
|
|
||||||
from tests import vim
|
import tests.modules.vim as vim
|
||||||
|
|
||||||
|
|
||||||
globals().update(vim._init())
|
globals().update(vim._init())
|
Loading…
x
Reference in New Issue
Block a user