diff --git a/python/helpers/tests/__main__.py b/python/helpers/tests/__main__.py new file mode 100644 index 000000000000..4edba9864788 --- /dev/null +++ b/python/helpers/tests/__main__.py @@ -0,0 +1,23 @@ +import os +import sys +import unittest + +_tests_dir = os.path.dirname(os.path.abspath(__file__)) +_helpers_dir = os.path.dirname(_tests_dir) + + +def discover_and_run_tests(): + suite = unittest.TestLoader().discover(_tests_dir) + runner = unittest.TextTestRunner() + try: + import teamcity.unittestpy + if teamcity.is_running_under_teamcity(): + runner = teamcity.unittestpy.TeamcityTestRunner() + except ImportError: + pass + runner.run(suite) + + +if __name__ == '__main__': + sys.path.append(_helpers_dir) + discover_and_run_tests() diff --git a/python/helpers/tests/build.gradle b/python/helpers/tests/build.gradle index c9a878cdb8ae..9fba03b7788c 100644 --- a/python/helpers/tests/build.gradle +++ b/python/helpers/tests/build.gradle @@ -23,7 +23,7 @@ envs { mustRunAfter 'build_envs' environment PYTHONPATH: ".:.." - commandLine new File(pythonDirectory, pythonName).absolutePath + '/bin/python', '-m', 'unittest' + commandLine new File(pythonDirectory, pythonName).absolutePath + '/bin/python', '__main__.py' } }