How to capture results from Pkg.test

When I test a package using Pkg.test("PackageName"), how do I capture the results in the calling process?

ie, something like results = Pkg.test("PackageName")

Is my only option to use a custom test set subtype? If this is my only option, are there examples of how I would access the results?

Thanks,
Philip

Pkg.test() won’t return to you a list of which packages failed and their error messages. It doesn’t because it’s setting up a clean environment for the tests, and they run inside it. One way to get test results is to use GitHub - JuliaTesting/TestReports.jl: Making JUnit style XML reports for your julia tests. This will write an XML file you can parse with EzXML, as in this example. TestReports.jl also demonstrates how to hook into the TestSet. You don’t need to make a subtype because the information is already there. I also found GitHub - fjarri/Jute.jl: A Py.Test-like testing framework for Julia illustrative, but both examples are lengthy. Maybe someone has a shorter example?

2 Likes