From b0330b33b7f9791446f78e66fdd79e1b7bba2a0d Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sun, 14 Jun 2026 09:16:02 -0400 Subject: [PATCH] Use SciMLTesting v1.2 folder-based run_tests Convert the grouped-tests harness to the SciMLTesting v1.2 folder model. runtests.jl is now `using SciMLTesting; run_tests()`; group membership is discovered from the test/ folder layout + test_groups.toml. Core = top-level test/*.jl. The inline Core testsets that previously lived in runtests.jl (version bumping, project-file handling, repository processing, legacy deprecations) are extracted into a self-contained test/core_tests.jl; each existing Core file gains its own `using` lines so it runs under an isolated @safetestset module. QA = test/qa/ (qa.jl moved in from the top level so the Core glob does not pick it up; keeps its sub-env Project.toml). multiprocess_testing_tests.jl was commented out of the old dispatcher, so it moves to test/shared/ (not a group folder) to preserve the exact per-GROUP test set. Added SciMLTesting + SafeTestsets to the root [extras]/[targets].test and to test/qa/Project.toml (with [compat]). test_groups.toml unchanged. Co-Authored-By: Chris Rackauckas Co-Authored-By: Claude Opus 4.8 (1M context) --- Project.toml | 6 +- test/core_tests.jl | 126 +++++++++++++++ test/documentation_cleanup_tests.jl | 3 +- test/explicit_imports_fixer_tests.jl | 4 +- test/formatting_tests.jl | 3 +- test/import_timing_analysis_tests.jl | 3 +- test/invalidation_analysis_tests.jl | 3 +- test/min_version_fixer_tests.jl | 3 +- test/qa/Project.toml | 10 +- test/{ => qa}/qa.jl | 0 test/runtests.jl | 152 +----------------- .../multiprocess_testing_tests.jl | 0 test/version_check_finder_tests.jl | 3 +- 13 files changed, 155 insertions(+), 161 deletions(-) create mode 100644 test/core_tests.jl rename test/{ => qa}/qa.jl (100%) rename test/{ => shared}/multiprocess_testing_tests.jl (100%) diff --git a/Project.toml b/Project.toml index 922e6eb..e41d9fb 100644 --- a/Project.toml +++ b/Project.toml @@ -28,6 +28,8 @@ JET = "0.9, 0.10, 0.11" JSON3 = "1" JuliaFormatter = "2" LocalRegistry = "0.5" +SafeTestsets = "0.0.1, 0.1, 1" +SciMLTesting = "1" SnoopCompileCore = "3" Statistics = "1" TOML = "1" @@ -37,7 +39,9 @@ julia = "1.10" [extras] JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" +SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["JET", "Test"] +test = ["JET", "SafeTestsets", "SciMLTesting", "Test"] diff --git a/test/core_tests.jl b/test/core_tests.jl new file mode 100644 index 0000000..00edcdb --- /dev/null +++ b/test/core_tests.jl @@ -0,0 +1,126 @@ +using OrgMaintenanceScripts +using Test +using TOML + +@testset "OrgMaintenanceScripts.jl" begin + @testset "Version bumping" begin + # Test bump_minor_version + @test OrgMaintenanceScripts.bump_minor_version("1.2.3") == "1.3.0" + @test OrgMaintenanceScripts.bump_minor_version("0.1.0") == "0.2.0" + @test OrgMaintenanceScripts.bump_minor_version("2.10.5") == "2.11.0" + + # Test invalid version format + @test_throws ErrorException OrgMaintenanceScripts.bump_minor_version("1.2") + @test_throws ErrorException OrgMaintenanceScripts.bump_minor_version("1.2.3.4") + end + + @testset "Project file handling" begin + # Create a temporary test project + mktempdir() do tmpdir + project_path = joinpath(tmpdir, "Project.toml") + + # Test with valid Project.toml + project_data = Dict( + "name" => "TestPackage", + "uuid" => "12345678-1234-1234-1234-123456789012", + "version" => "0.1.0" + ) + + open(project_path, "w") do io + TOML.print(io, project_data) + end + + result = OrgMaintenanceScripts.update_project_version(project_path) + @test !isnothing(result) + @test result[1] == "0.1.0" + @test result[2] == "0.2.0" + + # Verify file was updated + updated_project = TOML.parsefile(project_path) + @test updated_project["version"] == "0.2.0" + + # Test with missing version field + delete!(updated_project, "version") + open(project_path, "w") do io + TOML.print(io, updated_project) + end + + result = OrgMaintenanceScripts.update_project_version(project_path) + @test isnothing(result) + + # Test with non-existent file + result = OrgMaintenanceScripts.update_project_version(joinpath(tmpdir, "nonexistent.toml")) + @test isnothing(result) + end + end + + @testset "Repository processing" begin + # Create a mock repository structure + mktempdir() do tmpdir + # Main Project.toml + main_project = Dict( + "name" => "MainPackage", + "uuid" => "12345678-1234-1234-1234-123456789012", + "version" => "1.0.0" + ) + open(joinpath(tmpdir, "Project.toml"), "w") do io + TOML.print(io, main_project) + end + + # Create lib directory with subpackages + lib_dir = joinpath(tmpdir, "lib") + mkpath(lib_dir) + + for (i, pkg) in enumerate(["SubPkgA", "SubPkgB"]) + pkg_dir = joinpath(lib_dir, pkg) + mkpath(pkg_dir) + + sub_project = Dict( + "name" => pkg, + "uuid" => "12345678-1234-1234-1234-12345678901$i", + "version" => "0.$i.0" + ) + open(joinpath(pkg_dir, "Project.toml"), "w") do io + TOML.print(io, sub_project) + end + end + + # Initialize git repo + cd(tmpdir) do + run(`git init`) + run(`git config user.name "Test User"`) + run(`git config user.email "test@example.com"`) + run(`git add .`) + run(`git commit -m "Initial commit"`) + end + + # Test bump_and_register_repo + result = bump_and_register_repo(tmpdir) + + @test !isnothing(result) + # In test environment, registration will fail since there's no real registry + # So we expect all packages to be in the failed list + @test basename(tmpdir) in result.failed || basename(tmpdir) in result.registered + @test "SubPkgA" in result.failed || "SubPkgA" in result.registered + @test "SubPkgB" in result.failed || "SubPkgB" in result.registered + # Either all succeed or all fail (in tests, they'll all fail) + @test isempty(result.registered) || isempty(result.failed) + + # Verify versions were bumped + main_updated = TOML.parsefile(joinpath(tmpdir, "Project.toml")) + @test main_updated["version"] == "1.1.0" + + subA_updated = TOML.parsefile(joinpath(lib_dir, "SubPkgA", "Project.toml")) + @test subA_updated["version"] == "0.2.0" + + subB_updated = TOML.parsefile(joinpath(lib_dir, "SubPkgB", "Project.toml")) + @test subB_updated["version"] == "0.3.0" + end + end + + @testset "Basic functionality (legacy)" begin + # Test deprecated functions still exist but warn + @test_logs (:warn,) OrgMaintenanceScripts.update_manifests() + @test_logs (:warn,) OrgMaintenanceScripts.update_project_tomls() + end +end diff --git a/test/documentation_cleanup_tests.jl b/test/documentation_cleanup_tests.jl index b03c8d0..6cece8b 100644 --- a/test/documentation_cleanup_tests.jl +++ b/test/documentation_cleanup_tests.jl @@ -1,4 +1,5 @@ -# Note: OrgMaintenanceScripts is already loaded by runtests.jl +using OrgMaintenanceScripts +using Test @testset "Documentation Cleanup Tests" begin diff --git a/test/explicit_imports_fixer_tests.jl b/test/explicit_imports_fixer_tests.jl index 62e14bf..9274ccb 100644 --- a/test/explicit_imports_fixer_tests.jl +++ b/test/explicit_imports_fixer_tests.jl @@ -1,4 +1,6 @@ -# Note: OrgMaintenanceScripts is already loaded by runtests.jl +using OrgMaintenanceScripts +using Test +using TOML @testset "Explicit Imports Fixer" begin @testset "parse_explicit_imports_output" begin diff --git a/test/formatting_tests.jl b/test/formatting_tests.jl index eca4eef..735bbc8 100644 --- a/test/formatting_tests.jl +++ b/test/formatting_tests.jl @@ -1,4 +1,5 @@ -# Note: OrgMaintenanceScripts is already loaded by runtests.jl +using OrgMaintenanceScripts +using Test using Pkg @testset "Formatting Functions" begin diff --git a/test/import_timing_analysis_tests.jl b/test/import_timing_analysis_tests.jl index 07860ea..2612401 100644 --- a/test/import_timing_analysis_tests.jl +++ b/test/import_timing_analysis_tests.jl @@ -1,4 +1,5 @@ -# Note: OrgMaintenanceScripts is already loaded by runtests.jl +using OrgMaintenanceScripts +using Test @testset "Import Timing Analysis Tests" begin # Create a simple test package structure diff --git a/test/invalidation_analysis_tests.jl b/test/invalidation_analysis_tests.jl index 68bbc8e..22a5101 100644 --- a/test/invalidation_analysis_tests.jl +++ b/test/invalidation_analysis_tests.jl @@ -1,4 +1,5 @@ -# Note: OrgMaintenanceScripts is already loaded by runtests.jl +using OrgMaintenanceScripts +using Test @testset "Invalidation Analysis Tests" begin # Create a simple test package structure diff --git a/test/min_version_fixer_tests.jl b/test/min_version_fixer_tests.jl index cdf7822..9b292f5 100644 --- a/test/min_version_fixer_tests.jl +++ b/test/min_version_fixer_tests.jl @@ -1,4 +1,5 @@ -# Note: OrgMaintenanceScripts is already loaded by runtests.jl +using OrgMaintenanceScripts +using Test @testset "Minimum Version Fixer Tests" begin # Test helper functions diff --git a/test/qa/Project.toml b/test/qa/Project.toml index 5c00c49..1305b39 100644 --- a/test/qa/Project.toml +++ b/test/qa/Project.toml @@ -3,13 +3,17 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" OrgMaintenanceScripts = "87d49508-7ad8-40c6-ae47-b3ac92269cd4" +SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +[sources] +OrgMaintenanceScripts = {path = "../.."} + [compat] Aqua = "0.8" JET = "0.9, 0.10, 0.11" +SafeTestsets = "0.0.1, 0.1, 1" +SciMLTesting = "1" Test = "1" julia = "1.10" - -[sources] -OrgMaintenanceScripts = {path = "../.."} diff --git a/test/qa.jl b/test/qa/qa.jl similarity index 100% rename from test/qa.jl rename to test/qa/qa.jl diff --git a/test/runtests.jl b/test/runtests.jl index 242e23f..a18a7cc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,150 +1,2 @@ -using Pkg -using OrgMaintenanceScripts -using Test -using TOML -using Dates - -const GROUP = get(ENV, "GROUP", "All") - -if GROUP == "QA" - Pkg.activate(joinpath(@__DIR__, "qa")) - Pkg.develop(PackageSpec(path = joinpath(@__DIR__, ".."))) - Pkg.instantiate() - include("qa.jl") -end - -if GROUP == "All" || GROUP == "Core" - @testset "OrgMaintenanceScripts.jl" begin - @testset "Version bumping" begin - # Test bump_minor_version - @test OrgMaintenanceScripts.bump_minor_version("1.2.3") == "1.3.0" - @test OrgMaintenanceScripts.bump_minor_version("0.1.0") == "0.2.0" - @test OrgMaintenanceScripts.bump_minor_version("2.10.5") == "2.11.0" - - # Test invalid version format - @test_throws ErrorException OrgMaintenanceScripts.bump_minor_version("1.2") - @test_throws ErrorException OrgMaintenanceScripts.bump_minor_version("1.2.3.4") - end - - @testset "Project file handling" begin - # Create a temporary test project - mktempdir() do tmpdir - project_path = joinpath(tmpdir, "Project.toml") - - # Test with valid Project.toml - project_data = Dict( - "name" => "TestPackage", - "uuid" => "12345678-1234-1234-1234-123456789012", - "version" => "0.1.0" - ) - - open(project_path, "w") do io - TOML.print(io, project_data) - end - - result = OrgMaintenanceScripts.update_project_version(project_path) - @test !isnothing(result) - @test result[1] == "0.1.0" - @test result[2] == "0.2.0" - - # Verify file was updated - updated_project = TOML.parsefile(project_path) - @test updated_project["version"] == "0.2.0" - - # Test with missing version field - delete!(updated_project, "version") - open(project_path, "w") do io - TOML.print(io, updated_project) - end - - result = OrgMaintenanceScripts.update_project_version(project_path) - @test isnothing(result) - - # Test with non-existent file - result = OrgMaintenanceScripts.update_project_version(joinpath(tmpdir, "nonexistent.toml")) - @test isnothing(result) - end - end - - @testset "Repository processing" begin - # Create a mock repository structure - mktempdir() do tmpdir - # Main Project.toml - main_project = Dict( - "name" => "MainPackage", - "uuid" => "12345678-1234-1234-1234-123456789012", - "version" => "1.0.0" - ) - open(joinpath(tmpdir, "Project.toml"), "w") do io - TOML.print(io, main_project) - end - - # Create lib directory with subpackages - lib_dir = joinpath(tmpdir, "lib") - mkpath(lib_dir) - - for (i, pkg) in enumerate(["SubPkgA", "SubPkgB"]) - pkg_dir = joinpath(lib_dir, pkg) - mkpath(pkg_dir) - - sub_project = Dict( - "name" => pkg, - "uuid" => "12345678-1234-1234-1234-12345678901$i", - "version" => "0.$i.0" - ) - open(joinpath(pkg_dir, "Project.toml"), "w") do io - TOML.print(io, sub_project) - end - end - - # Initialize git repo - cd(tmpdir) do - run(`git init`) - run(`git config user.name "Test User"`) - run(`git config user.email "test@example.com"`) - run(`git add .`) - run(`git commit -m "Initial commit"`) - end - - # Test bump_and_register_repo - result = bump_and_register_repo(tmpdir) - - @test !isnothing(result) - # In test environment, registration will fail since there's no real registry - # So we expect all packages to be in the failed list - @test basename(tmpdir) in result.failed || basename(tmpdir) in result.registered - @test "SubPkgA" in result.failed || "SubPkgA" in result.registered - @test "SubPkgB" in result.failed || "SubPkgB" in result.registered - # Either all succeed or all fail (in tests, they'll all fail) - @test isempty(result.registered) || isempty(result.failed) - - # Verify versions were bumped - main_updated = TOML.parsefile(joinpath(tmpdir, "Project.toml")) - @test main_updated["version"] == "1.1.0" - - subA_updated = TOML.parsefile(joinpath(lib_dir, "SubPkgA", "Project.toml")) - @test subA_updated["version"] == "0.2.0" - - subB_updated = TOML.parsefile(joinpath(lib_dir, "SubPkgB", "Project.toml")) - @test subB_updated["version"] == "0.3.0" - end - end - - @testset "Basic functionality (legacy)" begin - # Test deprecated functions still exist but warn - @test_logs (:warn,) OrgMaintenanceScripts.update_manifests() - @test_logs (:warn,) OrgMaintenanceScripts.update_project_tomls() - end - - include("formatting_tests.jl") - include("min_version_fixer_tests.jl") - include("version_check_finder_tests.jl") - include("invalidation_analysis_tests.jl") - include("import_timing_analysis_tests.jl") - include("explicit_imports_fixer_tests.jl") - # Temporarily commented out due to syntax error in multiprocess_testing.jl - # include("multiprocess_testing_tests.jl") - include("documentation_cleanup_tests.jl") - # JET/Aqua static analysis runs in the QA group (GROUP=QA -> test/qa.jl). - end -end +using SciMLTesting +run_tests() diff --git a/test/multiprocess_testing_tests.jl b/test/shared/multiprocess_testing_tests.jl similarity index 100% rename from test/multiprocess_testing_tests.jl rename to test/shared/multiprocess_testing_tests.jl diff --git a/test/version_check_finder_tests.jl b/test/version_check_finder_tests.jl index ebc5423..f529a57 100644 --- a/test/version_check_finder_tests.jl +++ b/test/version_check_finder_tests.jl @@ -1,4 +1,5 @@ -# Note: OrgMaintenanceScripts is already loaded by runtests.jl +using OrgMaintenanceScripts +using Test @testset "Version Check Finder Tests" begin # Create temporary test files