Skip to content

Commit

Permalink
Remove unnecessary logging in runtests.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobjpeters committed Jun 14, 2024
1 parent 0aaa339 commit 5ef5c71
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 21 deletions.
3 changes: 3 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[extras]
Typstry = "f0ed7684-a786-439e-b1e3-3b82803b501e"
52 changes: 31 additions & 21 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

using Aqua: test_all
using Base: get_extension
using Aqua: test_all, test_ambiguities
using Base: get_extension, disable_logging
using ExplicitImports:
check_all_explicit_imports_are_public,
check_all_explicit_imports_via_owners,
Expand All @@ -12,42 +12,52 @@ using ExplicitImports:
using Dates: Dates
using Documenter: DocMeta.setdocmeta!, doctest
using LaTeXStrings: LaTeXStrings
using Logging: Debug, Info, disable_logging
using Markdown: Markdown
using Preferences: set_preferences!
using Test: @testset, @test, detect_ambiguities, detect_unbound_args
using Test: @testset, @test
using Typstry

set_preferences!("Typstry", "instability_check" => "error")

_doctest(_module, name) = doctest(_module; manual = "source", testset = "$name.jl Doctests")

_setdocmeta!(_module, x) = setdocmeta!(_module, :DocTestSetup,
:(using Preferences: set_preferences!; using Typstry; $x; set_preferences!("Typstry", "instability_check" => "error"));
recursive = true)

test_all(Typstry)
set_preferences!("Typstry", "instability_check" => "error")

@testset "Aqua.jl" begin
test_all(Typstry; ambiguities = false)
test_ambiguities(Typstry)
end

_setdocmeta!(Typstry, nothing)
_doctest(Typstry, "Typstry")
disable_logging(Info)

@testset "Doctests" begin
_doctest(Typstry, "Typstry")

for extension in [:Dates, :LaTeXStrings, :Markdown]
_module = get_extension(Typstry, Symbol(extension, "Extension"))
_setdocmeta!(_module, :(using $extension))
_doctest(_module, extension)
for extension in [:Dates, :LaTeXStrings, :Markdown]
_module = get_extension(Typstry, Symbol(extension, "Extension"))
_setdocmeta!(_module, :(using $extension))
_doctest(_module, extension)
end
end

disable_logging(Debug)

@testset "ExplicitImports.jl" begin
@test isnothing(check_all_explicit_imports_are_public(Typstry; ignore = (:MD, :Stateful,
:code_mode, :depth, :escape_raw_string, :indent, :parse, :print_parameters, :show_raw, :workload)))
@test isnothing(check_all_explicit_imports_via_owners(Typstry))
@test isnothing(check_all_qualified_accesses_are_public(Typstry))
@test isnothing(check_all_qualified_accesses_via_owners(Typstry))
@test isnothing(check_no_implicit_imports(Typstry))
@test isnothing(check_no_self_qualified_accesses(Typstry))
@test isnothing(check_no_stale_explicit_imports(Typstry))
end

@testset "Test.jl" begin
@test isempty(detect_ambiguities(Typstry))
@test isempty(detect_unbound_args(Typstry))
for check in (
check_all_explicit_imports_via_owners,
check_all_qualified_accesses_are_public,
check_all_qualified_accesses_via_owners,
check_no_implicit_imports,
check_no_self_qualified_accesses,
check_no_stale_explicit_imports
)
@test isnothing(check(Typstry))
end
end

0 comments on commit 5ef5c71

Please sign in to comment.