Tests success on local but fails in Travis CI


#1

Hi All!
The question is in title. I had this error on travis:

Error During Test
  Test threw an exception of type MethodError
  Expression: countBases(readStringFromFile(joinpath(@__DIR__(), "data", "rosalind_dna.txt"))) == (201, 182, 223, 195)
  MethodError: Cannot `convert` an object of type Type{String} to an object of type Array{UInt8,1}
  This may have arisen from a call to the constructor Array{UInt8,1}(...),
  since type constructors fall back to convert methods.
  Stacktrace:
   [1] read(::IOStream, ::Type{T} where T) at ./io.jl:528
   [2] open(::Bioinformatics.##3#4, ::String) at ./iostream.jl:152
   [3] readStringFromFile(::String) at /home/travis/.julia/v0.6/Bioinformatics/test/../src/Bioinformatics.jl:80
   [4] include_from_node1(::String) at ./loading.jl:576
   [5] include(::String) at ./sysimg.jl:14
   [6] process_options(::Base.JLOptions) at ./client.jl:305
   [7] _start() at ./client.jl:371
ERROR: LoadError: There was an error during testing
while loading /home/travis/.julia/v0.6/Bioinformatics/test/runtests.jl, in expression starting on line 38

Code is here: https://github.com/mrtkp9993/Bioinformatics.jl/blob/master/src/Bioinformatics.jl
Also you can fix it and create a pull request.

Thank you.


#2

read(f, String) is only possible on Julia v0.7. I’m guessing you’re running Julia v0.6 on Travis.


#3

But I’m using 0.6.2.2 on local, not 0.7.


#4

Are you using Compat locally?


#5

I think I found my problem.
Firstly ,I changed my local Julia version to 0.7.
In my readFile method, I’m using strip function that returns a substring. But my countBases function expects a String, not a substring.

$ julia runtests.jl 
Error During Test at /Users/muratkoptur/Desktop/github/Bioinformatics.jl/test/runtests.jl:57
  Test threw exception MethodError(Main.Bioinformatics.countBases, ("ATACTTGGCCCAAGGCTTTCCGCAACGATTGGTCAGGCTTTACTGCGCGCTTATTAGGCTTCGAGTCCAGACATGCGACGTAAATACGATGAGGGTCTACTGATCAGTCTAAATGGGAGAGTCAGCGAGGATTGCGTCTTGACGATCAAATTAGTGAGGGAGGCGTTGCTCGCGATTTTTCCGTTCAATGTACGACATCGTATCATTGACCTTTACGTAATTCAGAGACCGGAACGGAGTGGTTACCACTGACGCTAACGCAGGTAGGAGACGCGAATCAATTCCGACCGCCGCGTAGAGGGGCGTTAACGCGGAAAGAACGCACCAATGCTAGCTGTTTATTAAGCCTTTCGTGAGATAAAGTACAACAACCGCCAGGCCCAGTTCAAGCAAACTAGCTAACGAGCGCTGCTCCGTCGATATATCTATGACCGTGCCTTGAATGCGCTCATGGGTCGCAAGACGGGAAGGGTTAGCCGAGAAATTGATCTGATACACACACTGCCGACTCTGGCGTTGAGTCTGTTCGGTAATGCCAGGCCCACGATGCCTCTAATAGAGCACGTTACTTGGCACGGCGGAGCCGATGTCTAGGATCATCAGGCTGTTGGAGTAACAAATTAAGTTTAAAGACGCCTTTGCCTGTATGTCCTTTAGGCGATTGCTCGTAGGCACAGTTGCGAGTCTCGACCCTATGTTGGAAGAGGAGCAAGGGACCGTGTATCCCAGTCTAGGCGATGTGGTAGGGTAAGTTTGAGCCTGTTCGTGACTCTCGCATACATAAGGAGTAGGAAATGGTTC",), 0x0000000000006bbc)
  Expression: Bioinformatics.countBases(Bioinformatics.readStringFromFile(joinpath(#= /Users/muratkoptur/Desktop/github/Bioinformatics.jl/test/runtests.jl:59 =# @__DIR__(), "data", "rosalind_dna.txt")))
  MethodError: no method matching countBases(::SubString{String})
  Closest candidates are:
    countBases(!Matched::String) at /Users/muratkoptur/Desktop/github/Bioinformatics.jl/src/Bioinformatics.jl:92
  Stacktrace:
   [1] top-level scope at none:0
   [2] include at ./boot.jl:317 [inlined]
   [3] include_relative(::Module, ::String) at ./loading.jl:1034
   [4] include(::Module, ::String) at ./sysimg.jl:29
   [5] exec_options(::Base.JLOptions) at ./client.jl:234
   [6] _start() at ./client.jl:427
ERROR: LoadError: There was an error during testing
in expression starting at /Users/muratkoptur/Desktop/github/Bioinformatics.jl/test/runtests.jl:57

Edit: Done. I used String(strip(...)) and problem solved.