Cobra
Cobra copied to clipboard
test_apiserver.py单元测试本地测试会出现问题
test_apiserver.py function test_close_api()
def test_close_api():
os.remove(config_path)
p.terminate()
p.join()
# wait for scan data
s_sid_file = os.path.join(running_path, '{sid}_data'.format(sid=s_sid))
while not os.path.exists(s_sid_file):
time.sleep(1)
# wait for port closed
s = socket.socket()
s.settimeout(0.5)
while s.connect_ex(('localhost', 5000)) == 0:
time.sleep(0.5)
assert not os.path.exists(config_path)
如果后台有任何python在跑,比如ss,这个单元测试就跑不通了
@40huo 看看
现在不检测 Python 进程了啊,只看扫描结果文件是否写入和 API 端口是否还占用。