Run interactive tests on MacOS
This commit is contained in:
parent
998ccf959e
commit
f3b96caa65
@ -1,58 +1,56 @@
|
|||||||
# TerminalMenus.jl has issues in environments without a TTY,
|
@testset "Interactive mode" begin
|
||||||
# which seems to be the case in Travis CI OSX builds.
|
@testset "Template creation" begin
|
||||||
# https://travis-ci.org/invenia/PkgTemplates.jl/jobs/267682403#L115
|
write(stdin.buffer, "$me\n\n\r\n\n\nd")
|
||||||
# https://github.com/nick-paul/TerminalMenus.jl/issues/5
|
t = interactive_template()
|
||||||
# This also affects any time we write to stdin.buffer, because
|
@test t.user == me
|
||||||
# IOStreams do not have that attribute.
|
@test t.host == "github.com"
|
||||||
# Therefore, we skip any interactive tests on OSX builds.
|
@test isempty(t.license)
|
||||||
|
@test t.authors == LibGit2.getconfig("user.name", "")
|
||||||
|
@test t.dir == default_dir
|
||||||
|
@test t.julia_version == VERSION
|
||||||
|
@test !t.ssh
|
||||||
|
@test isempty(t.plugins)
|
||||||
|
|
||||||
@testset "Interactive template creation" begin
|
if isempty(LibGit2.getconfig("github.user", ""))
|
||||||
write(stdin.buffer, "$me\n\n\r\n\n\nd")
|
write(stdin.buffer, "\n")
|
||||||
t = interactive_template()
|
@test_throws ArgumentError t = interactive_template()
|
||||||
@test t.user == me
|
end
|
||||||
@test t.host == "github.com"
|
|
||||||
@test isempty(t.license)
|
|
||||||
@test t.authors == LibGit2.getconfig("user.name", "")
|
|
||||||
@test t.dir == default_dir
|
|
||||||
@test t.julia_version == VERSION
|
|
||||||
@test !t.ssh
|
|
||||||
@test isempty(t.plugins)
|
|
||||||
|
|
||||||
if isempty(LibGit2.getconfig("github.user", ""))
|
down = '\x1b' * "[B" # Down array key.
|
||||||
write(stdin.buffer, "\n")
|
write(stdin.buffer, "$me\ngitlab.com\n$down\r$me\n$test_file\n0.5\nyes\n$down\r$down\rd\n\n")
|
||||||
@test_throws ArgumentError t = interactive_template()
|
t = interactive_template()
|
||||||
|
@test t.user == me
|
||||||
|
@test t.host == "gitlab.com"
|
||||||
|
# Not sure if the order the licenses are displayed in is consistent.
|
||||||
|
@test !isempty(t.license)
|
||||||
|
@test t.authors == me
|
||||||
|
@test t.dir == abspath(test_file)
|
||||||
|
@test t.julia_version == v"0.5.0"
|
||||||
|
@test t.ssh
|
||||||
|
# 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", "")
|
||||||
|
@test t.dir == default_dir
|
||||||
|
@test t.julia_version == VERSION
|
||||||
|
@test !t.ssh
|
||||||
|
@test isempty(t.plugins)
|
||||||
|
println()
|
||||||
end
|
end
|
||||||
|
|
||||||
down = '\x1b' * "[B" # Down array key.
|
@testset "Package generation" begin
|
||||||
write(stdin.buffer, "$me\ngitlab.com\n$down\r$me\n$test_file\n0.5\nyes\n$down\r$down\rd\n\n")
|
write(stdin.buffer, "$me\n\n\r\n\n\n\n\n\nd")
|
||||||
t = interactive_template()
|
generate_interactive(test_pkg; gitconfig=gitconfig)
|
||||||
@test t.user == me
|
@test isdir(joinpath(default_dir, test_pkg))
|
||||||
@test t.host == "gitlab.com"
|
rm(joinpath(default_dir, test_pkg); force=true, recursive=true)
|
||||||
# Not sure if the order the licenses are displayed in is consistent.
|
end
|
||||||
@test !isempty(t.license)
|
|
||||||
@test t.authors == me
|
|
||||||
@test t.dir == abspath(test_file)
|
|
||||||
@test t.julia_version == v"0.5.0"
|
|
||||||
@test t.ssh
|
|
||||||
# Like above, not sure which plugins this will generate.
|
|
||||||
@test length(t.plugins) == 2
|
|
||||||
|
|
||||||
write(stdin.buffer, "$me\nd")
|
@testset "Plugins" begin
|
||||||
t = interactive_template(; fast=true)
|
include("plugins.jl")
|
||||||
@test t.user == me
|
end
|
||||||
@test t.host == "github.com"
|
|
||||||
@test t.license == "MIT"
|
|
||||||
@test t.authors == LibGit2.getconfig("user.name", "")
|
|
||||||
@test t.dir == default_dir
|
|
||||||
@test t.julia_version == VERSION
|
|
||||||
@test !t.ssh
|
|
||||||
@test isempty(t.plugins)
|
|
||||||
println()
|
|
||||||
end
|
|
||||||
|
|
||||||
@testset "Interactive package generation" begin
|
|
||||||
write(stdin.buffer, "$me\n\n\r\n\n\n\n\n\nd")
|
|
||||||
generate_interactive(test_pkg; gitconfig=gitconfig)
|
|
||||||
@test isdir(joinpath(default_dir, test_pkg))
|
|
||||||
rm(joinpath(default_dir, test_pkg); force=true, recursive=true)
|
|
||||||
end
|
end
|
||||||
|
@ -13,6 +13,11 @@ end
|
|||||||
struct Bar <: CustomPlugin end
|
struct Bar <: CustomPlugin end
|
||||||
# A dummy Plugin subtype.
|
# A dummy Plugin subtype.
|
||||||
struct Baz <: Plugin end
|
struct Baz <: Plugin end
|
||||||
|
# A Documenter with extra kwargs
|
||||||
|
struct Qux <: Documenter
|
||||||
|
assets::Vector{AbstractString}
|
||||||
|
additional_kwargs::Union{AbstractDict, NamedTuple}
|
||||||
|
end
|
||||||
|
|
||||||
# Various options to be passed into templates.
|
# Various options to be passed into templates.
|
||||||
const me = "christopher-dG"
|
const me = "christopher-dG"
|
||||||
@ -95,16 +100,6 @@ write(test_file, template_text)
|
|||||||
@test_throws ArgumentError Template(; user=me, license="FakeLicense")
|
@test_throws ArgumentError Template(; user=me, license="FakeLicense")
|
||||||
end
|
end
|
||||||
|
|
||||||
# TerminalMenus doesn't work quite right on Travis OSX.
|
|
||||||
if get(ENV, "TRAVIS_OS_NAME", "") != "osx"
|
|
||||||
include(joinpath("interactive", "interactive.jl"))
|
|
||||||
@testset "Interactive plugin creation" begin
|
|
||||||
include(joinpath("interactive", "plugins.jl"))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
@info "Skipping tests that require TerminalMenus on OSX"
|
|
||||||
end
|
|
||||||
|
|
||||||
@testset "Show methods" begin
|
@testset "Show methods" begin
|
||||||
pkg_dir = replace(default_dir, homedir() => "~")
|
pkg_dir = replace(default_dir, homedir() => "~")
|
||||||
buf = IOBuffer()
|
buf = IOBuffer()
|
||||||
@ -397,12 +392,6 @@ end
|
|||||||
include(joinpath("plugins", "githubpages.jl"))
|
include(joinpath("plugins", "githubpages.jl"))
|
||||||
end
|
end
|
||||||
|
|
||||||
# A Documenter with extra kwargs
|
|
||||||
struct Qux <: Documenter
|
|
||||||
assets::Vector{AbstractString}
|
|
||||||
additional_kwargs::Union{AbstractDict, NamedTuple}
|
|
||||||
end
|
|
||||||
|
|
||||||
@testset "Documenter add kwargs" begin
|
@testset "Documenter add kwargs" begin
|
||||||
t = Template(; user=me)
|
t = Template(; user=me)
|
||||||
pkg_dir = joinpath(t.dir, test_pkg)
|
pkg_dir = joinpath(t.dir, test_pkg)
|
||||||
@ -442,4 +431,6 @@ end
|
|||||||
check_kwargs(kwargs, warn_str)
|
check_kwargs(kwargs, warn_str)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
include(joinpath("interactive", "interactive.jl"))
|
||||||
|
|
||||||
rm(test_file)
|
rm(test_file)
|
||||||
|
Loading…
Reference in New Issue
Block a user