Add option to only clone and immediately exit the test runner.
This commit is contained in:
parent
c017806b1d
commit
a23911f7f9
16
test.py
16
test.py
@ -357,7 +357,7 @@ class _VimTest(unittest.TestCase):
|
|||||||
_VimTest.version, _ = subprocess.Popen(["vim", "--version"],
|
_VimTest.version, _ = subprocess.Popen(["vim", "--version"],
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
|
||||||
if PYTHON3:
|
if PYTHON3:
|
||||||
_VimTest.version = stdout.decode("utf-8")
|
_VimTest.version = _VimTest.version.decode("utf-8")
|
||||||
|
|
||||||
if self.plugins and not self.test_plugins:
|
if self.plugins and not self.test_plugins:
|
||||||
return self.skipTest("Not testing integration with other plugins.")
|
return self.skipTest("Not testing integration with other plugins.")
|
||||||
@ -3363,6 +3363,8 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
p.add_option("-v", "--verbose", dest="verbose", action="store_true",
|
p.add_option("-v", "--verbose", dest="verbose", action="store_true",
|
||||||
help="print name of tests as they are executed")
|
help="print name of tests as they are executed")
|
||||||
|
p.add_option("--clone-plugins", action="store_true",
|
||||||
|
help="Only clones dependant plugins and exits the test runner.")
|
||||||
p.add_option("--plugins", action="store_true",
|
p.add_option("--plugins", action="store_true",
|
||||||
help="Run integration tests with other Vim plugins.")
|
help="Run integration tests with other Vim plugins.")
|
||||||
p.add_option("--interface", type=str,
|
p.add_option("--interface", type=str,
|
||||||
@ -3386,11 +3388,14 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
return o, args
|
return o, args
|
||||||
|
|
||||||
|
def main():
|
||||||
options,selected_tests = parse_args()
|
options,selected_tests = parse_args()
|
||||||
|
|
||||||
test_loader = unittest.TestLoader()
|
test_loader = unittest.TestLoader()
|
||||||
all_test_suites = test_loader.loadTestsFromModule(__import__("test"))
|
all_test_suites = test_loader.loadTestsFromModule(__import__("test"))
|
||||||
|
|
||||||
|
vim = None
|
||||||
|
if not options.clone_plugins:
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
raise RuntimeError("TODO: TestSuite is broken under windows. Volunteers wanted!.")
|
raise RuntimeError("TODO: TestSuite is broken under windows. Volunteers wanted!.")
|
||||||
# vim = VimInterfaceWindows()
|
# vim = VimInterfaceWindows()
|
||||||
@ -3401,15 +3406,14 @@ if __name__ == '__main__':
|
|||||||
elif options.interface == "tmux":
|
elif options.interface == "tmux":
|
||||||
vim = VimInterfaceTmux(options.session)
|
vim = VimInterfaceTmux(options.session)
|
||||||
|
|
||||||
# Inform all test case which screen session to use
|
|
||||||
suite = unittest.TestSuite()
|
suite = unittest.TestSuite()
|
||||||
all_other_plugins = set()
|
all_other_plugins = set()
|
||||||
for s in all_test_suites:
|
for s in all_test_suites:
|
||||||
for test in s:
|
for test in s:
|
||||||
test.vim = vim
|
|
||||||
test.interrupt = options.interrupt
|
test.interrupt = options.interrupt
|
||||||
test.retries = options.retries
|
test.retries = options.retries
|
||||||
test.test_plugins = options.plugins
|
test.test_plugins = options.plugins
|
||||||
|
test.vim = vim
|
||||||
all_other_plugins.update(test.plugins)
|
all_other_plugins.update(test.plugins)
|
||||||
|
|
||||||
if len(selected_tests):
|
if len(selected_tests):
|
||||||
@ -3418,8 +3422,10 @@ if __name__ == '__main__':
|
|||||||
continue
|
continue
|
||||||
suite.addTest(test)
|
suite.addTest(test)
|
||||||
|
|
||||||
if options.plugins:
|
if options.plugins or options.clone_plugins:
|
||||||
setup_other_plugins(all_other_plugins)
|
setup_other_plugins(all_other_plugins)
|
||||||
|
if options.clone_plugins:
|
||||||
|
return
|
||||||
|
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
v = 2
|
v = 2
|
||||||
@ -3427,4 +3433,6 @@ if __name__ == '__main__':
|
|||||||
v = 1
|
v = 1
|
||||||
res = unittest.TextTestRunner(verbosity=v).run(suite)
|
res = unittest.TextTestRunner(verbosity=v).run(suite)
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
# vim:fileencoding=utf-8:foldmarker={{{#,#}}}:
|
# vim:fileencoding=utf-8:foldmarker={{{#,#}}}:
|
||||||
|
Loading…
Reference in New Issue
Block a user