Cobra icon indicating copy to clipboard operation
Cobra copied to clipboard

test_apiserver.py单元测试本地测试会出现问题

Open LoRexxar opened this issue 7 years ago • 2 comments

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,这个单元测试就跑不通了

LoRexxar avatar Sep 07 '17 03:09 LoRexxar

@40huo 看看

FeeiCN avatar Sep 07 '17 03:09 FeeiCN

现在不检测 Python 进程了啊,只看扫描结果文件是否写入和 API 端口是否还占用。

40huo avatar Sep 07 '17 03:09 40huo