在putty
会话中运行nosetests
时,命令提示停止工作。例如,我键入的任何键都变成)
到目前为止,我找到的唯一恢复方法是重新启动会话。你知道吗
我运行的命令是:
nosetests -v --with-xunitmp -m "(?:\b|_)[Tt]est" --xunitmp-file nosetests.xml --processes=10 --process-timeout=600
我使用nosetests1.3.7
和python3.5.1
我把范围缩小了一点。你知道吗
举个例子:
from unittest import TestCase
from subprocess import Popen
import time
class MyTest(TestCase):
def test_this(self):
self.assertTrue(True)
def test_with_process(self):
process = Popen(['watch', 'ls'])
time.sleep(1)
if process.poll() is None:
process.kill()
将子进程重定向到/dev/null
似乎解决了这个问题:
from unittest import TestCase
from subprocess import Popen, DEVNULL
import time
class MyTest(TestCase):
def test_this(self):
self.assertTrue(True)
def test_with_process(self):
process = Popen(['watch', 'ls'],
stdout=DEVNULL,
stderr=DEVNULL,
stdin=DEVNULL)
time.sleep(1)
if process.poll() is not None:
print("KILLING")
process.kill()
process.communicate()
它解决了问题,我想知道为什么会发生这种事。。。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐