pytest+allure 接口自动化测试报告,生成本地服务并自动打开时失败

pytest+allure 接口自动化测试报告,生成本地服务并自动打开时失败
可以生成测试报告 但是需要手动打开,

img


img

subprocess.call('allure generate '+shufile+' -o '+baofile+' --clean', shell=True)#读取json文件并生成html报告
logger.info("生成测试报告,并存放于:"+baofile)
subprocess.call('allure open -h 127.0.0.1 -p 9999 '+baofile+'', shell=True)#生成一个本地的服务并自动打开html报告
logger.info("测试报告生成完成:"+baofile)
2021-12-29 10:08:32.185 | INFO     | __main__:<module>:23 - 生成测试报告,并存放于:D:\PycharmProjects\untitled1\baogao/20211229
Starting web server...
2021-12-29 10:08:32.419:INFO::main: Logging initialized @190ms to org.eclipse.jetty.util.log.StdErrLog
Could not serve the report
java.io.IOException: Failed to bind to activate.navicat.com/127.0.0.1:9999
    at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
    at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
    at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
    at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
    at org.eclipse.jetty.server.Server.doStart(Server.java:401)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
    at io.qameta.allure.Commands.open(Commands.java:144)
    at io.qameta.allure.CommandLine.run(CommandLine.java:165)
    at java.util.Optional.orElseGet(Optional.java:267)
    at io.qameta.allure.CommandLine.main(CommandLine.java:88)
Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:433)
    at sun.nio.ch.Net.bind(Net.java:425)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
    ... 10 more
2021-12-29 10:08:32.526 | INFO     | __main__:<module>:26 - 测试报告生成完成:D:\PycharmProjects\untitled1\baogao/20211229

Process finished with exit code 0