Python unittest slow and tests failing when running under TeamCity -


i have testsuite written in python/unittest+teamcitytestrunner , running under linux.

most of tests involve running separate thread subprocess.popen tested app (which console app, running multiple subprocesses/plugins - c++ code) , checking if: subprocess/plugin of app restarted when killed, creating files has create, etc.

the problem when run test suite - ssh build machine (vm), running script against binary/app - tests pass.

when run same test suite against same binary/app teamcity, tests fail.

after debugging, found out app runs/loads when run teamcity-unittest-subprocess.popen.

what can culprit of this? has teamcitytestrunner additional overhead cause behavior? can it?

the culprit seems overhead caused running under teamcity, on slow vm , overhead of subprocess.popen

the old code did not work me was:

cmd = [binary, 'param1'] outfile = open(redirect_to, 'w') subprocess.call(cmd, stdout=outfile) 

the new, faster in practice turned out is:

cmd = [binary, 'param1'] redirect_to = '/tmp/out' p = os.popen(' '.join(cmd) + '2>&1 >' + redirect_to) p.close() 

more info here: http://essays.ajs.com/2011/02/python-subprocess-vs-ospopen-overhead.html


Comments