有没有办法获取裤子代码覆盖率的结果?

时间:2019-04-02 16:45:06

标签: python code-coverage pants

我想在脚本中查看代码覆盖率的结果,然后该脚本确定用户是否可以继续进行。裤子有此功能吗?除了将其通过管道传输到外部文件并进行解析之外,还有其他方法吗?

现在,它会将所有内容打印到stdout,这并不是我尝试做的最好的选择。最重要的是,当我通过管道传输到另一个文件时,我没有得到实际的代码覆盖率,只是编译裤子来完成它,就像这样

    09:55:36 00:00 [main]
               (To run a reporting server: ./pants server)
09:55:36 00:00   [setup]
09:55:37 00:01     [parse]
               Executing tasks in goals: bootstrap -> imports -> unpack-jars -> jvm-platform-validate -> deferred-sources -> gen -> resolve -> resources -> pyprep -> compile -> test
09:55:37 00:01   [bootstrap]
09:55:37 00:01     [substitute-aliased-targets]
09:55:37 00:01     [jar-dependency-management]
09:55:37 00:01     [bootstrap-jvm-tools]
09:55:37 00:01     [provide-tools-jar]
09:55:37 00:01   [imports]
09:55:37 00:01     [ivy-imports]
09:55:37 00:01   [unpack-jars]
09:55:37 00:01     [unpack-jars]
09:55:37 00:01   [jvm-platform-validate]
09:55:37 00:01     [jvm-platform-validate]
09:55:37 00:01   [deferred-sources]
09:55:37 00:01     [deferred-sources]
09:55:37 00:01   [gen]
09:55:37 00:01     [antlr-java]
09:55:37 00:01     [antlr-py]
09:55:37 00:01     [jaxb]
09:55:37 00:01     [protoc]
09:55:37 00:01     [ragel]
09:55:37 00:01     [thrift-java]
09:55:37 00:01     [thrift-py]
09:55:37 00:01     [wire]
09:55:37 00:01     [go-thrift]
09:55:37 00:01   [resolve]
09:55:37 00:01     [ivy]
09:55:37 00:01     [coursier]
09:55:37 00:01     [go]
09:55:37 00:01   [resources]
09:55:37 00:01     [prepare]
09:55:37 00:01     [services]
09:55:37 00:01   [pyprep]
09:55:37 00:01     [interpreter]
09:55:37 00:01     [build-local-dists]
09:55:37 00:01     [requirements]
09:55:37 00:01     [sources]
09:55:37 00:01   [compile]
09:55:37 00:01     [compile-jvm-prep-command]
09:55:37 00:01       [jvm_prep_command]
09:55:37 00:01     [compile-prep-command]
09:55:37 00:01     [compile]
09:55:37 00:01     [zinc]
09:55:37 00:01     [jvm-dep-check]
09:55:37 00:01     [go]
09:55:37 00:01   [test]
09:55:37 00:01     [test-jvm-prep-command]
09:55:37 00:01       [jvm_prep_command]
09:55:37 00:01     [test-prep-command]
09:55:37 00:01     [test]
09:55:37 00:01     [pytest-prep]
09:55:38 00:02     [pytest]
                   tests/python/pom_manager:all                                        .....   SUCCESS
                   tests/python/pom_manager:pom_util_test                              .....   SUCCESS
                   tests/python/pom_manager:pom_manager_test                           .....   SUCCESS
                   tests/python/pom_manager:pom_worker_test                            .....   SUCCESS
                   tests/python/pom_manager:pom_validator_test                         .....   SUCCESS
                   tests/python/pom_manager:lc_util_test                               .....   SUCCESS
09:55:38 00:02     [junit]
09:55:38 00:02     [go]
               Waiting for background workers to finish.
09:55:38 00:02   [complete]
               SUCCESS

1 个答案:

答案 0 :(得分:0)

对于以后遇到此问题的任何人,我发现裤子都存储了一个包含所有代码覆盖范围的html文件,该文件很容易解析。