Add an entry point to discover and run helpers tests with teamcity-messages

Utilize it to run tests on TC instead of plain "-m unittest discover".

GitOrigin-RevId: e021c4f5dd01f5a5b9b0d989d6befd795e394499
This commit is contained in:
Mikhail Golubev
2019-06-10 19:57:45 +03:00
committed by intellij-monorepo-bot
parent d685842863
commit 020ff1765a
2 changed files with 24 additions and 1 deletions
+23
View File
@@ -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()
+1 -1
View File
@@ -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'
}
}