Skip to content

Commit 16e4f85

Browse files
authored
make skipping stdlib tests work (#26700)
* make skipping stdlib tests work * also allow filtering of test groups in stdlibs * make ambiguous run first * Symbol -> String in errorshow
1 parent 209a8f5 commit 16e4f85

File tree

2 files changed

+33
-31
lines changed

2 files changed

+33
-31
lines changed

test/choosetests.jl

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -124,27 +124,6 @@ function choosetests(choices = [])
124124
prepend!(tests, STDLIBS)
125125
end
126126

127-
128-
explicit_pkg = "Pkg/pkg" in tests
129-
explicit_pkg3 = "Pkg3/pkg" in tests
130-
explicit_libgit2 = "LibGit2/online" in tests
131-
new_tests = String[]
132-
for test in tests
133-
if test in STDLIBS
134-
testfile = joinpath(STDLIB_DIR, test, "test", "testgroups")
135-
if isfile(testfile)
136-
prepend!(new_tests, (test * "/") .* readlines(testfile))
137-
else
138-
push!(new_tests, test)
139-
end
140-
end
141-
end
142-
filter!(x -> (x != "stdlib" && !(x in STDLIBS)) , tests)
143-
prepend!(tests, new_tests)
144-
explicit_pkg || filter!(x -> x != "Pkg/pkg", tests)
145-
explicit_pkg3 || filter!(x -> x != "Pkg3/pkg", tests)
146-
explicit_libgit2 || filter!(x -> x != "LibGit2/online", tests)
147-
148127
# do ambiguous first to avoid failing if ambiguities are introduced by other tests
149128
if "ambiguous" in skip_tests
150129
filter!(x -> x != "ambiguous", tests)
@@ -183,5 +162,28 @@ function choosetests(choices = [])
183162

184163
filter!(!in(skip_tests), tests)
185164

165+
explicit_pkg = "Pkg/pkg" in tests
166+
explicit_pkg3 = "Pkg3/pkg" in tests
167+
explicit_libgit2 = "LibGit2/online" in tests
168+
new_tests = String[]
169+
for test in tests
170+
if test in STDLIBS
171+
testfile = joinpath(STDLIB_DIR, test, "test", "testgroups")
172+
if isfile(testfile)
173+
prepend!(new_tests, (test * "/") .* readlines(testfile))
174+
else
175+
push!(new_tests, test)
176+
end
177+
end
178+
end
179+
filter!(x -> (x != "stdlib" && !(x in STDLIBS)) , tests)
180+
append!(tests, new_tests)
181+
explicit_pkg || filter!(x -> x != "Pkg/pkg", tests)
182+
explicit_pkg3 || filter!(x -> x != "Pkg3/pkg", tests)
183+
explicit_libgit2 || filter!(x -> x != "LibGit2/online", tests)
184+
185+
# Filter out tests from the test groups in the stdlibs
186+
filter!(!in(skip_tests), tests)
187+
186188
tests, net_on, exit_on_error, seed
187189
end

test/errorshow.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ end
322322
@test occursin(r"^@doc \(macro with \d+ method[s]?\)$", repr("text/plain", getfield(Base, Symbol("@doc"))))
323323

324324
method_defs_lineno = @__LINE__() + 1
325-
Base.Symbol() = throw(ErrorException("1"))
326-
(::Symbol)() = throw(ErrorException("2"))
325+
String() = throw(ErrorException("1"))
326+
(::String)() = throw(ErrorException("2"))
327327
EightBitType() = throw(ErrorException("3"))
328328
(::EightBitType)() = throw(ErrorException("4"))
329329
EightBitTypeT() = throw(ErrorException("5"))
@@ -338,10 +338,10 @@ let err_str,
338338
sp = Base.source_path()
339339
sn = basename(sp)
340340

341-
@test sprint(show, which(Symbol, Tuple{})) ==
342-
"Symbol() in $curmod_str at $sp:$(method_defs_lineno + 0)"
343-
@test sprint(show, which(:a, Tuple{})) ==
344-
"(::Symbol)() in $curmod_str at $sp:$(method_defs_lineno + 1)"
341+
@test sprint(show, which(String, Tuple{})) ==
342+
"String() in $curmod_str at $sp:$(method_defs_lineno + 0)"
343+
@test sprint(show, which("a", Tuple{})) ==
344+
"(::String)() in $curmod_str at $sp:$(method_defs_lineno + 1)"
345345
@test sprint(show, which(EightBitType, Tuple{})) ==
346346
"$(curmod_prefix)EightBitType() in $curmod_str at $sp:$(method_defs_lineno + 2)"
347347
@test sprint(show, which(reinterpret(EightBitType, 0x54), Tuple{})) ==
@@ -359,10 +359,10 @@ let err_str,
359359
@test repr("text/plain", FunctionLike()) == "(::$(curmod_prefix)FunctionLike) (generic function with 1 method)"
360360
@test repr("text/plain", Core.arraysize) == "arraysize (built-in function)"
361361

362-
err_str = @except_stackframe Symbol() ErrorException
363-
@test err_str == "Symbol() at $sn:$(method_defs_lineno + 0)"
364-
err_str = @except_stackframe :a() ErrorException
365-
@test err_str == "(::Symbol)() at $sn:$(method_defs_lineno + 1)"
362+
err_str = @except_stackframe String() ErrorException
363+
@test err_str == "String() at $sn:$(method_defs_lineno + 0)"
364+
err_str = @except_stackframe "a"() ErrorException
365+
@test err_str == "(::String)() at $sn:$(method_defs_lineno + 1)"
366366
err_str = @except_stackframe EightBitType() ErrorException
367367
@test err_str == "$(curmod_prefix)EightBitType() at $sn:$(method_defs_lineno + 2)"
368368
err_str = @except_stackframe i() ErrorException

0 commit comments

Comments
 (0)