|
45 | 45 |
|
46 | 46 | # test we can call runtests manually w/ directory |
47 | 47 | @testset "manual `runtests(dir)`" begin |
48 | | - results = encased_testset() do |
49 | | - runtests(joinpath(TEST_PKG_DIR, "NoDeps.jl")) |
| 48 | + using IOCapture |
| 49 | + c = IOCapture.capture() do |
| 50 | + encased_testset(() -> runtests(joinpath(TEST_PKG_DIR, "NoDeps.jl"))) |
50 | 51 | end |
| 52 | + results = c.value |
51 | 53 | @test n_passed(results) == 2 # NoDeps has two test files with a test each |
| 54 | + @test contains(c.output, "[ Tests Completed: 2/2 test items were run.") |
52 | 55 | end |
53 | 56 |
|
54 | 57 | @testset "manual `runtests(file)`" begin |
55 | 58 | # test we can point to a file at the base of the package (not just in `src` or `test`) |
56 | | - results = encased_testset() do |
57 | | - runtests(joinpath(TEST_PKG_DIR, "NoDeps.jl", "toplevel_tests.jl")) |
| 59 | + using IOCapture |
| 60 | + c = IOCapture.capture() do |
| 61 | + encased_testset(() -> runtests(joinpath(TEST_PKG_DIR, "NoDeps.jl", "toplevel_tests.jl"))) |
58 | 62 | end |
| 63 | + results = c.value |
59 | 64 | @test n_passed(results) == 1 |
| 65 | + @test contains(c.output, "[ Tests Completed: 1/1 test items were run.") |
60 | 66 | end |
61 | 67 |
|
62 | 68 | @testset "`runtests(path)` auto finds testsetups" begin |
@@ -273,20 +279,28 @@ end |
273 | 279 | nworkers = 2 |
274 | 280 | @testset "runtests with nworkers = $nworkers" verbose=true begin |
275 | 281 | @testset "Pkg.test() $pkg" for pkg in TEST_PKGS |
276 | | - results = with_test_package(pkg) do |
277 | | - withenv("RETESTITEMS_NWORKERS" => nworkers) do |
278 | | - Pkg.test() |
| 282 | + c = IOCapture.capture() do |
| 283 | + with_test_package(pkg) do |
| 284 | + withenv("RETESTITEMS_NWORKERS" => nworkers) do |
| 285 | + Pkg.test() |
| 286 | + end |
279 | 287 | end |
280 | 288 | end |
| 289 | + results = c.value |
281 | 290 | @test all_passed(results) |
| 291 | + @test contains(c.output, "[ Tests Completed") |
282 | 292 | end |
283 | 293 | @testset "Pkg.test() DontPass.jl" begin |
284 | | - results = with_test_package("DontPass.jl") do |
285 | | - withenv("RETESTITEMS_NWORKERS" => 2) do |
286 | | - Pkg.test() |
| 294 | + c = IOCapture.capture() do |
| 295 | + with_test_package("DontPass.jl") do |
| 296 | + withenv("RETESTITEMS_NWORKERS" => 2) do |
| 297 | + Pkg.test() |
| 298 | + end |
287 | 299 | end |
288 | 300 | end |
| 301 | + results = c.value |
289 | 302 | @test length(non_passes(results)) > 0 |
| 303 | + @test contains(c.output, "[ Tests Completed") |
290 | 304 | end |
291 | 305 | end |
292 | 306 |
|
|
0 commit comments