Move Python tests.* modules to tests/modules, rename tests/path

This commit is contained in:
Foo 2017-04-30 15:05:18 +03:00
parent 2a1aef1bac
commit c30383a194
30 changed files with 68 additions and 67 deletions

View File

@ -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
View 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

View File

@ -12,7 +12,7 @@ from powerline.renderer import Renderer
from powerline.lib.config import ConfigLoader
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)
@ -175,7 +175,7 @@ def get_powerline(config, **kwargs):
TestPowerline,
_helpers=helpers,
ext='test',
renderer_module='tests.lib.config_mock',
renderer_module='tests.modules.lib.config_mock',
logger=Logger(),
**kwargs
)

View File

@ -59,7 +59,7 @@ class FSTree(object):
self.p = TestPowerline(
_paths=self.get_config_paths(self.root),
ext='test',
renderer_module='tests.lib.config_mock',
renderer_module='tests.modules.lib.config_mock',
**self.p_kwargs
)
if os.environ.get('POWERLINE_RUN_LINT_DURING_TESTS'):

View File

@ -13,7 +13,7 @@ import pexpect
from powerline.lib.unicode import u
from tests.lib.vterm import VTerm, Dimensions
from tests.modules.lib.vterm import VTerm, Dimensions
class MutableDimensions(object):

View File

@ -13,8 +13,8 @@ else:
from powerline.commands.main import get_argparser, finish_args
from tests import TestCase
from tests.lib import replace_attr
from tests.modules import TestCase
from tests.modules.lib import replace_attr
class TestParser(TestCase):
@ -140,5 +140,5 @@ class TestParser(TestCase):
if __name__ == '__main__':
from tests import main
from tests.modules import main
main()

0
tests/test_commandt_plugin.vim Executable file → Normal file
View File

View File

@ -11,8 +11,8 @@ from shutil import rmtree
from powerline.lib.dict import mergedicts_copy as mdc
from powerline import Powerline
from tests import TestCase
from tests.lib.config_mock import select_renderer, UT
from tests.modules import TestCase
from tests.modules.lib.config_mock import select_renderer, UT
CONFIG_DIR = 'tests/config'
@ -139,7 +139,7 @@ class WithConfigTree(object):
select_renderer(simpler_renderer=True)
self.p = TestPowerline(
ext='test',
renderer_module='tests.lib.config_mock',
renderer_module='tests.modules.lib.config_mock',
**self.p_kwargs
)
if os.environ.get('POWERLINE_RUN_LINT_DURING_TESTS'):
@ -266,5 +266,5 @@ class TestMerging(TestCase):
if __name__ == '__main__':
from tests import main
from tests.modules import main
main()

View File

@ -5,8 +5,8 @@ from time import sleep
from copy import deepcopy
from functools import wraps
from tests import TestCase
from tests.lib.config_mock import get_powerline, add_watcher_events, UT
from tests.modules import TestCase
from tests.modules.lib.config_mock import get_powerline, add_watcher_events, UT
config = {
@ -315,5 +315,5 @@ class TestConfigReload(TestCase):
if __name__ == '__main__':
from tests import main
from tests.modules import main
main()

View File

@ -7,11 +7,12 @@ import os
from functools import wraps
from copy import deepcopy
import tests.vim as vim_module
import tests.modules.vim as vim_module
from tests import TestCase
from tests.lib.config_mock import get_powerline, get_powerline_raw, swap_attributes, UT
from tests.lib import Args, replace_item
from tests.modules import TestCase
from tests.modules.lib.config_mock import (get_powerline, get_powerline_raw,
swap_attributes, UT)
from tests.modules.lib import Args, replace_item
def highlighted_string(s, group, **kwargs):
@ -797,7 +798,6 @@ 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
@ -817,7 +817,7 @@ class TestVim(TestCase):
import powerline as powerline_module
with swap_attributes(config, powerline_module):
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': {
'foo': {
'contents': '“bar”'
@ -840,7 +840,7 @@ class TestVim(TestCase):
@classmethod
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
def tearDownClass(cls):
@ -873,5 +873,5 @@ class TestLemonbar(TestRender):
if __name__ == '__main__':
from tests import main
from tests.modules import main
main()

0
tests/test_empty_encoding.old.vim Executable file → Normal file
View File

View File

@ -15,8 +15,8 @@ from powerline.lib.dict import updated
from powerline.bindings.tmux import get_tmux_version
from powerline import get_fallback_logger
from tests.lib.terminal import (ExpectProcess, MutableDimensions,
do_terminal_tests, get_env)
from tests.modules.lib.terminal import (ExpectProcess, MutableDimensions,
do_terminal_tests, get_env)
VTERM_TEST_DIR = os.path.abspath('tests/vterm_tmux')

View File

@ -11,8 +11,8 @@ from subprocess import check_call
from glob import glob1
from traceback import print_exc
from tests.lib.terminal import (ExpectProcess, MutableDimensions,
do_terminal_tests, get_env)
from tests.modules.lib.terminal import (ExpectProcess, MutableDimensions,
do_terminal_tests, get_env)
VTERM_TEST_DIR = os.path.abspath('tests/vterm_vim')

View File

@ -21,8 +21,8 @@ from powerline.lib.shell import run_cmd
import powerline.lib.unicode as plu
from tests.lib import Pl, replace_attr
from tests import TestCase, SkipTest
from tests.modules.lib import Pl, replace_attr
from tests.modules import TestCase, SkipTest
try:
@ -736,5 +736,5 @@ class TestVCS(TestCase):
if __name__ == '__main__':
from tests import main
from tests.modules import main
main()

View File

@ -5,8 +5,8 @@ import os
from powerline.lib.config import ConfigLoader
from tests import TestCase
from tests.lib.fsconfig import FSTree
from tests.modules import TestCase
from tests.modules.lib.fsconfig import FSTree
FILE_ROOT = os.path.join(os.path.dirname(__file__), 'cfglib')
@ -48,5 +48,5 @@ class TestLoaderCondition(TestCase):
if __name__ == '__main__':
from tests import main
from tests.modules import main
main()

View File

@ -3,8 +3,8 @@ from __future__ import (unicode_literals, division, absolute_import, print_funct
import powerline.listers.i3wm as i3wm
from tests.lib import Args, replace_attr, Pl
from tests import TestCase
from tests.modules.lib import Args, replace_attr, Pl
from tests.modules import TestCase
class TestI3WM(TestCase):
@ -223,5 +223,5 @@ class TestI3WM(TestCase):
if __name__ == '__main__':
from tests import main
from tests.modules import main
main()

0
tests/test_local_overrides.vim Executable file → Normal file
View File

View File

@ -14,8 +14,8 @@ from shutil import rmtree
from powerline import finish_common_config, create_logger
from tests import TestCase
from tests.lib import replace_attr
from tests.modules import TestCase
from tests.modules.lib import replace_attr
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__':
from tests import main
from tests.modules import main
main()

0
tests/test_nerdtree_plugin.vim Executable file → Normal file
View File

0
tests/test_plugin_file.vim Executable file → Normal file
View File

View File

@ -9,10 +9,10 @@ import os
import json
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 import TestCase
from tests.modules.lib import Args, urllib_read, replace_attr
from tests.modules import TestCase
from powerline import NotInterceptedError
from powerline.segments.common import wthr
@ -101,7 +101,7 @@ class TestVimConfig(TestCase):
@classmethod
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
def tearDownClass(cls):
@ -197,5 +197,5 @@ def tearDownModule():
if __name__ == '__main__':
from tests import main
from tests.modules import main
main()

View File

@ -13,10 +13,11 @@ from powerline.segments import shell, tmux, pdb, i3wm
from powerline.lib.vcs import get_fallback_create_watcher
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 import TestCase, SkipTest
from tests.modules.lib import (Args, urllib_read, replace_attr, new_module,
replace_module_module, replace_env, Pl)
from tests.modules import TestCase, SkipTest
def get_dummy_guess(**kwargs):
@ -1598,7 +1599,7 @@ class TestVim(TestCase):
@classmethod
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
cls.vim = vim
from powerline.segments.common import vcs
@ -1672,5 +1673,5 @@ def tearDownModule():
if __name__ == '__main__':
from tests import main
from tests.modules import main
main()

View File

@ -6,10 +6,10 @@ import sys
from functools import partial
import tests.vim as vim_module
import tests.modules.vim as vim_module
from tests.lib import Pl
from tests import TestCase
from tests.modules.lib import Pl
from tests.modules import TestCase
class TestVim(TestCase):
@ -22,7 +22,7 @@ class TestVim(TestCase):
@classmethod
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
cls.vim = vim
@ -32,5 +32,5 @@ class TestVim(TestCase):
if __name__ == '__main__':
from tests import main
from tests.modules import main
main()

0
tests/test_tabline.vim Executable file → Normal file
View File

View File

@ -13,7 +13,7 @@ from powerline.lib.watcher.uv import UvNotFound
from powerline import get_fallback_logger
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', ''))
@ -241,5 +241,5 @@ def tearDownModule():
if __name__ == '__main__':
from tests import main
from tests.modules import main
main()

View File

@ -1,7 +1,7 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
from tests import vim
import tests.modules.vim as vim
globals().update(vim._init())