Q:

Teamcity messages unittest doesnt see tests in Python 2

I have a project with following stucture

test_scripts.py consists of single unittest.TestCase class and ends with the following code.
if __name__ == '__main__':
    try:
        from teamcity import is_running_under_teamcity
        from teamcity.unittestpy import TeamcityTestRunner
        if is_running_under_teamcity():
            runner = TeamcityTestRunner()
        else:
            runner = unittest.TextTestRunner()
    except ModuleNotFoundError:
        runner = unittest.TextTestRunner()
    unittest.main(testRunner=runner)

So when I try to run it with python3
python3 -m teamcity.unittestpy I get
... some tests output
##teamcity[testFinished timestamp='2019-11-14T14:08:24.591' duration='0' flowId='tests.test_scripts.Test.test_sub' name='tests.test_scripts.Test.test_sub']

Ran 7 tests in 0.004s

OK

But when I do the same with Python 2
python -m teamcity.unittestpy
##teamcity[testCount timestamp='2019-11-14T14:09:16.392' count='0']

Ran 0 tests in 0.000s

OK

I'm 100% sure that teamcity-messages is installed on python interpreter.
Why doesn't it see tests?

A:

In Python 2 it works only with python -m teamcity.unittestpy discover call. 
This call also works for Python 3.

