From 3733cd3a55eff974636e40b486e6241a3660cc3f Mon Sep 17 00:00:00 2001 From: Chris de Graaf Date: Thu, 24 Aug 2017 14:03:05 -0500 Subject: [PATCH] Separate interactive tests and don't run them on Travis OSX --- test/interactive.jl | 53 +++++++++++++++++++++++++++++++++++++++++++++ test/tests.jl | 50 ++---------------------------------------- 2 files changed, 55 insertions(+), 48 deletions(-) create mode 100644 test/interactive.jl diff --git a/test/interactive.jl b/test/interactive.jl new file mode 100644 index 0000000..035a3e3 --- /dev/null +++ b/test/interactive.jl @@ -0,0 +1,53 @@ +# TerminalMenus.jl has issues in environments without a TTY, +# which seems to be the case in Travis CI OSX builds. +# https://travis-ci.org/invenia/PkgTemplates.jl/jobs/267682403#L115 + +@testset "Interactive template creation" begin + write(STDIN.buffer, "$me\n\n\r\n\n\n\n\n\nd") + t = interactive_template() + @test t.user == me + @test t.host == "github.com" + @test isempty(t.license) + @test t.authors == LibGit2.getconfig("user.name", "") + @test t.years == string(Dates.year(Dates.today())) + @test t.dir == Pkg.dir() + @test t.julia_version == VERSION + @test isempty(t.requirements) + @test isempty(t.gitconfig) + @test isempty(t.plugins) + + if isempty(LibGit2.getconfig("github.user", "")) + write(STDIN.buffer, "\n") + @test_throws ArgumentError t = interactive_template() + end + + write(STDIN.buffer, "$me\ngitlab.com\n$('\x1b')[B\r$me\n2016\n$test_file\n0.5\nX Y\nA B\n\n$('\x1b')[B\r$('\x1b')[B\rd\n\n") + t = interactive_template() + @test t.user == me + @test t.host == "gitlab.com" + # Not sure if the order the licenses are displayed is consistent. + @test !isempty(t.license) + @test t.authors == me + @test t.years == "2016" + @test t.dir == test_file + @test t.julia_version == v"0.5.0" + @test Set(t.requirements) == Set(["X", "Y"]) + @test t.gitconfig == Dict("A" => "B") + # Like above, not sure which plugins this will generate. + @test length(t.plugins) == 2 + + write(STDIN.buffer, "$me\nd") + t = interactive_template(; fast=true) + @test t.user == me + @test t.host == "github.com" + @test t.license == "MIT" + @test t.authors == LibGit2.getconfig("user.name", "") + # I guess this could technically break if it runs on New Year's Eve... + @test t.years == string(Dates.year(Dates.today())) + @test t.dir == Pkg.dir() + @test t.julia_version == VERSION + @test isempty(t.requirements) + @test isempty(t.gitconfig) + @test isempty(t.plugins) + println() +end diff --git a/test/tests.jl b/test/tests.jl index dd1749e..e447cec 100644 --- a/test/tests.jl +++ b/test/tests.jl @@ -109,54 +109,8 @@ write(test_file, template_text) @test_throws ArgumentError t = Template(; user=me, license="FakeLicense") end -@testset "Interactive template creation" begin - write(STDIN.buffer, "$me\n\n\r\n\n\n\n\n\nd") - t = interactive_template() - @test t.user == me - @test t.host == "github.com" - @test isempty(t.license) - @test t.authors == LibGit2.getconfig("user.name", "") - @test t.years == string(Dates.year(Dates.today())) - @test t.dir == Pkg.dir() - @test t.julia_version == VERSION - @test isempty(t.requirements) - @test isempty(t.gitconfig) - @test isempty(t.plugins) - - if isempty(LibGit2.getconfig("github.user", "")) - write(STDIN.buffer, "\n") - @test_throws ArgumentError t = interactive_template() - end - - write(STDIN.buffer, "$me\ngitlab.com\n$('\x1b')[B\r$me\n2016\n$test_file\n0.5\nX Y\nA B\n\n$('\x1b')[B\r$('\x1b')[B\rd\n\n") - t = interactive_template() - @test t.user == me - @test t.host == "gitlab.com" - # Not sure if the order the licenses are displayed is consistent. - @test !isempty(t.license) - @test t.authors == me - @test t.years == "2016" - @test t.dir == test_file - @test t.julia_version == v"0.5.0" - @test Set(t.requirements) == Set(["X", "Y"]) - @test t.gitconfig == Dict("A" => "B") - # Like above, not sure which plugins this will generate. - @test length(t.plugins) == 2 - - write(STDIN.buffer, "$me\nd") - t = interactive_template(; fast=true) - @test t.user == me - @test t.host == "github.com" - @test t.license == "MIT" - @test t.authors == LibGit2.getconfig("user.name", "") - # I guess this could technically break if it runs on New Year's Eve... - @test t.years == string(Dates.year(Dates.today())) - @test t.dir == Pkg.dir() - @test t.julia_version == VERSION - @test isempty(t.requirements) - @test isempty(t.gitconfig) - @test isempty(t.plugins) - println() +if get(ENV, "TRAVIS_OS_NAME", "") != "osx" + include("interactive.jl") end @testset "Plugin creation" begin