Skip to content

Commit a86bd4c

Browse files
Streamline preference tests with single reset_defaults! call
- Added reset_defaults!() at the beginning to enable testing mode for entire test suite - Removed redundant reset_defaults!() calls from individual tests - Testing mode now enabled once for all preference tests - Cleaner test structure with single point of testing mode activation The preference system verification now works consistently across all tests with 52 passed tests proving the dual preference system functions correctly. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 6150d55 commit a86bd4c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

test/preferences.jl

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ using LinearSolve, LinearAlgebra, Test
22
using Preferences
33

44
@testset "Dual Preference System Integration Tests" begin
5+
# Enable testing mode for preference system verification
6+
LinearSolve.reset_defaults!()
7+
58
# Clear any existing preferences to start clean
69
target_eltypes = ["Float32", "Float64", "ComplexF32", "ComplexF64"]
710
size_categories = ["tiny", "small", "medium", "large", "big"]
@@ -86,10 +89,7 @@ using Preferences
8689
println("⚠️ FastLapackInterface/FastLUFactorization not available: ", e)
8790
end
8891

89-
# Reset defaults to pick up the new preferences for testing
90-
LinearSolve.reset_defaults!()
91-
92-
# Test algorithm choice
92+
# Test algorithm choice (testing mode enabled at test start)
9393
chosen_alg_test = LinearSolve.defaultalg(A, b, LinearSolve.OperatorAssumptions(true))
9494

9595
if fastlapack_loaded
@@ -134,10 +134,7 @@ using Preferences
134134
println("⚠️ RecursiveFactorization/RFLUFactorization not available: ", e)
135135
end
136136

137-
# Reset defaults to pick up the new preferences for testing
138-
LinearSolve.reset_defaults!()
139-
140-
# Test algorithm choice with RecursiveFactorization available
137+
# Test algorithm choice with RecursiveFactorization available (testing mode enabled at test start)
141138
chosen_alg_with_rf = LinearSolve.defaultalg(A, b, LinearSolve.OperatorAssumptions(true))
142139

143140
if recursive_loaded
@@ -233,10 +230,7 @@ using Preferences
233230
Preferences.set_preferences!(LinearSolve, "best_always_loaded_Float64_$(size_cat)" => algorithm; force = true)
234231
end
235232

236-
# Reset defaults to pick up the new preferences for testing
237-
LinearSolve.reset_defaults!()
238-
239-
# Test sizes that should land in each category
233+
# Test sizes that should land in each category (testing mode enabled at test start)
240234
test_cases = [
241235
# (test_size, expected_category, expected_algorithm)
242236
(15, "tiny", LinearSolve.DefaultAlgorithmChoice.GenericLUFactorization),

0 commit comments

Comments
 (0)