From f5b6af29c4d2caa3738d2e75038bc140b54e6053 Mon Sep 17 00:00:00 2001 From: Mus M Date: Wed, 12 Apr 2017 09:17:49 -0400 Subject: [PATCH 1/2] Depend and use HTTP instead of Requests --- .travis.yml | 1 - REQUIRE | 4 ++-- src/codecovio.jl | 9 +++------ src/coveralls.jl | 17 +++++++---------- src/memalloc.jl | 8 ++++---- test/runtests.jl | 5 ++--- 6 files changed, 18 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 34d2236..f27625d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: julia julia: - - 0.4 - 0.5 - nightly notifications: diff --git a/REQUIRE b/REQUIRE index 3abb877..fee01e5 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,5 +1,5 @@ -julia 0.4 +julia 0.5 JSON -Requests +HTTP Git Compat 0.9.5 diff --git a/src/codecovio.jl b/src/codecovio.jl index 5acde0c..47ca3e3 100644 --- a/src/codecovio.jl +++ b/src/codecovio.jl @@ -8,10 +8,7 @@ web service. It exports the `submit` and `submit_token` methods. """ module Codecov - using Requests - using Coverage - using JSON - using Compat + using Coverage, HTTP, JSON export submit, submit_token, submit_local, submit_generic @@ -154,9 +151,9 @@ module Codecov if !dry_run heads = Dict("Content-Type" => "application/json") data = to_json(fcs) - req = Requests.post(URI(uri_str); json = data, headers = heads) + req = HTTP.post(uri_str; body = data, headers = heads) println("Result of submission:") - println(Compat.UTF8String(req.data)) + println(String(req.data)) end end diff --git a/src/coveralls.jl b/src/coveralls.jl index 0a600e0..651f90f 100644 --- a/src/coveralls.jl +++ b/src/coveralls.jl @@ -7,10 +7,7 @@ This module provides functionality to push coverage information to the Coveralls web service. It exports the `submit` and `submit_token` methods. """ module Coveralls - using Coverage - using Requests - using JSON - using Compat + using Coverage, HTTP, JSON export submit, submit_token @@ -54,11 +51,11 @@ module Coveralls "service_name" => "travis-ci", "source_files" => map(to_json, fcs)) println("Submitting data to Coveralls...") - req = Requests.post( - URI("https://coveralls.io/api/v1/jobs"), + req = HTTP.post( + "https://coveralls.io/api/v1/jobs", files = [FileParam(JSON.json(data),"application/json","json_file","coverage.json")]) println("Result of submission:") - println(Compat.UTF8String(req.data)) + println(String(req.data)) end # query_git_info @@ -118,9 +115,9 @@ module Coveralls end end - r = post(URI("https://coveralls.io/api/v1/jobs"), files = - [FileParam(JSON.json(data),"application/json","json_file","coverage.json")]) + r = HTTP.post("https://coveralls.io/api/v1/jobs", + files = [FileParam(JSON.json(data),"application/json","json_file","coverage.json")]) println("Result of submission:") - println(Compat.UTF8String(r.data)) + println(String(r.data)) end end # module Coveralls diff --git a/src/memalloc.jl b/src/memalloc.jl index 0028a84..f1c254f 100644 --- a/src/memalloc.jl +++ b/src/memalloc.jl @@ -2,7 +2,7 @@ immutable MallocInfo bytes::Int - filename::Compat.UTF8String + filename::String linenumber::Int end @@ -32,7 +32,7 @@ function analyze_malloc_files(files) end function find_malloc_files(dirs) - files = Compat.String[] + files = String[] for dir in dirs filelist = readdir(dir) for file in filelist @@ -46,10 +46,10 @@ function find_malloc_files(dirs) end files end -find_malloc_files(file::Compat.String) = find_malloc_files([file]) +find_malloc_files(file::String) = find_malloc_files([file]) analyze_malloc(dirs) = analyze_malloc_files(find_malloc_files(dirs)) -analyze_malloc(dir::Compat.String) = analyze_malloc([dir]) +analyze_malloc(dir::String) = analyze_malloc([dir]) isfuncexpr(ex::Expr) = ex.head == :function || (ex.head == :(=) && typeof(ex.args[1]) == Expr && ex.args[1].head == :call) diff --git a/test/runtests.jl b/test/runtests.jl index 54179db..0b45432 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,7 +5,6 @@ ####################################################################### using Coverage, Base.Test, Compat -using Compat.String # test our filename matching. These aren't exported functions but it's probably # a good idea to have explicit tests for them, as they're used to match files @@ -38,12 +37,12 @@ cd(dirname(@__DIR__)) do end # Test a file from scratch - srcname = joinpath("test", "data","testparser.jl") + srcname = joinpath(dirname(@__DIR__), "test", "data", "testparser.jl") covname = srcname*".cov" # clean out any previous coverage files. Don't use clean_folder because we # need to preserve the pre-baked coverage file Coverage.jl.cov clean_file(srcname) - cmdstr = "include(\"$srcname\"); using Base.Test; @test f2(2) == 4" + cmdstr = "include(\"$(escape_string(srcname))\"); using Base.Test; @test f2(2) == 4" run(`$JULIA_HOME/julia --code-coverage=user -e $cmdstr`) r = process_file(srcname, datadir) # The next one is the correct one, but julia & JuliaParser don't insert a line number after the 1-line @doc -> test From c1db335dd75cd3f0d7e4c1ba53c1b5dfd84b4e84 Mon Sep 17 00:00:00 2001 From: Mus M Date: Fri, 12 May 2017 00:33:36 -0400 Subject: [PATCH 2/2] test --- test/runtests.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 0b45432..fd1dc1e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -9,6 +9,7 @@ using Coverage, Base.Test, Compat # test our filename matching. These aren't exported functions but it's probably # a good idea to have explicit tests for them, as they're used to match files # that get deleted +@testset "Coverage" begin @test Coverage.iscovfile("test.jl.cov") @test Coverage.iscovfile("test.jl.2934.cov") @@ -247,3 +248,5 @@ withenv( end end + + end # testset