From 5ef5c71af91c9e2f537326733b85c3930a386794 Mon Sep 17 00:00:00 2001 From: Jakob Peters Date: Fri, 14 Jun 2024 10:16:31 -0700 Subject: [PATCH] Remove unnecessary logging in runtests.jl --- test/Project.toml | 3 +++ test/runtests.jl | 52 ++++++++++++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/test/Project.toml b/test/Project.toml index b9ed9f9..4cf0f60 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -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" diff --git a/test/runtests.jl b/test/runtests.jl index f96dd14..87ed267 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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, @@ -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