Skip to content

Custom Julia test sets with output similar to that of Python's unittest

License

Notifications You must be signed in to change notification settings

mlhetland/DotTestSets.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DotTestSets

The DotTestSets module provides the custom test set type DotTestSet, which (to some extent) emulates the behavior of Python's unittest (in non-verbose mode), with line-wrapping. For example, the following test suite …

using Test, DotTestSets, Primes

@testset DotTestSet begin
    for i = 1:100
        @test i ≠ 39
    end
end

… produces the following output:

......................................F...............................
..............................
----------------------------------------------------------------------
Test Failed at /Users/mlh/Dropbox/DotTestSets.jl/test/runtests.jl:5
  Expression: i ≠ 39
   Evaluated: 39 ≠ 39
----------------------------------------------------------------------
Ran 100 tests in 0.947 s

FAILED (failures=1)

Nesting DotTestSets yield just a single stream of dots. Errors are marked with E:

using Test, DotTestSets

@testset DotTestSet begin

    @test error()

end

This yields the following output:

E
----------------------------------------------------------------------
Error During Test at ...
  Test threw exception
  Expression: error()

  Stacktrace:
   [1] error() at ./error.jl:42
   ...
----------------------------------------------------------------------
Ran 1 tests in 1.277 s

FAILED (errors=1)

About

Custom Julia test sets with output similar to that of Python's unittest

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages