mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-22505: Introduce `_DISABLE_BUFFERING` that user may set for default test run configuration to use as workaround until runners are fixed.
Setting this variable disables buffering. May lead to output mess (i.e. stderr may go to wrong test node) but allows people to use debug console
This commit is contained in:
@@ -4,12 +4,14 @@ import re
|
||||
import nose
|
||||
import sys
|
||||
|
||||
from _jb_runner_tools import jb_start_tests, jb_patch_separator, jb_doc_args
|
||||
from _jb_runner_tools import jb_start_tests, jb_patch_separator, jb_doc_args, JB_DISABLE_BUFFERING
|
||||
from teamcity.nose_report import TeamcityReport
|
||||
|
||||
if __name__ == '__main__':
|
||||
path, targets, additional_args = jb_start_tests()
|
||||
sys.argv += [path] if path else jb_patch_separator(targets, fs_glue="/", python_glue=".", fs_to_python_glue=".py:")
|
||||
sys.argv += additional_args
|
||||
if JB_DISABLE_BUFFERING and "-s" not in sys.argv:
|
||||
sys.argv += ["-s"]
|
||||
jb_doc_args("Nosetest", sys.argv)
|
||||
nose.main(addplugins=[TeamcityReport()])
|
||||
|
||||
@@ -5,7 +5,7 @@ import sys
|
||||
import pytest
|
||||
from _pytest.config import get_plugin_manager
|
||||
|
||||
from _jb_runner_tools import jb_start_tests, jb_patch_separator, jb_doc_args
|
||||
from _jb_runner_tools import jb_start_tests, jb_patch_separator, jb_doc_args, JB_DISABLE_BUFFERING
|
||||
from teamcity import pytest_plugin
|
||||
|
||||
|
||||
@@ -17,11 +17,15 @@ if __name__ == '__main__':
|
||||
# When file is launched in py.test it should be file.py: you can't provide it as bare module
|
||||
joined_targets = [t + ".py" if ":" not in t else t for t in joined_targets]
|
||||
sys.argv += [path] if path else joined_targets
|
||||
jb_doc_args("py.test", sys.argv[1:])
|
||||
|
||||
# plugin is discovered automatically in 3, but not in 2
|
||||
# to prevent "plugin already registered" problem we check it first
|
||||
plugins_to_load = []
|
||||
if not get_plugin_manager().hasplugin("pytest-teamcity"):
|
||||
plugins_to_load.append(pytest_plugin)
|
||||
pytest.main(sys.argv[1:], plugins_to_load)
|
||||
|
||||
args = sys.argv[1:]
|
||||
if JB_DISABLE_BUFFERING and "-s" not in args:
|
||||
args += ["-s"]
|
||||
jb_doc_args("py.test", args)
|
||||
pytest.main(args, plugins_to_load)
|
||||
|
||||
@@ -14,6 +14,11 @@ from teamcity import teamcity_presence_env_var, messages
|
||||
if teamcity_presence_env_var not in os.environ:
|
||||
os.environ[teamcity_presence_env_var] = "LOCAL"
|
||||
|
||||
# Providing this env variable disables output buffering.
|
||||
# anything sent to stdout/stderr goes to IDE directly, not after test is over like it is done by default.
|
||||
# out and err are not in sync, so output may go to wrong test
|
||||
JB_DISABLE_BUFFERING = "JB_DISABLE_BUFFERING" in os.environ
|
||||
|
||||
|
||||
def _parse_parametrized(part):
|
||||
"""
|
||||
|
||||
@@ -3,7 +3,7 @@ import os
|
||||
import sys
|
||||
from unittest import main
|
||||
|
||||
from _jb_runner_tools import jb_start_tests, jb_doc_args
|
||||
from _jb_runner_tools import jb_start_tests, jb_doc_args, JB_DISABLE_BUFFERING
|
||||
from teamcity import unittestpy
|
||||
|
||||
if __name__ == '__main__':
|
||||
@@ -32,4 +32,4 @@ if __name__ == '__main__':
|
||||
jb_doc_args("unittests", args)
|
||||
# Working dir should be on path, that is how unittest work when launched from command line
|
||||
sys.path.append(os.getcwd())
|
||||
main(argv=args, module=None, testRunner=unittestpy.TeamcityTestRunner, buffer=True)
|
||||
main(argv=args, module=None, testRunner=unittestpy.TeamcityTestRunner, buffer=not JB_DISABLE_BUFFERING)
|
||||
|
||||
Reference in New Issue
Block a user