Skip to content

Commit bb9c717

Browse files
Rename reset_defaults! to make_preferences_dynamic!
Renamed the function to better reflect its purpose: - **Old name**: reset_defaults!() - **New name**: make_preferences_dynamic!() - **Better naming**: Clearly indicates it makes preferences dynamic for testing - **Updated**: Test file and documentation to use new name The new name better describes what the function does - it makes the preference system dynamic by switching from compile-time constants to runtime preference checking for testing verification. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 9881aeb commit bb9c717

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

docs/src/advanced/internal_api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ LinearSolve.defaultalg
3333
LinearSolve.get_tuned_algorithm
3434
LinearSolve.is_algorithm_available
3535
LinearSolve.show_algorithm_choices
36-
LinearSolve.reset_defaults!
36+
LinearSolve.make_preferences_dynamic!
3737
```
3838

3939
### Preference System Internals

src/preferences.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,19 @@ const AUTOTUNE_PREFS_SET = let
143143
any_set
144144
end
145145

146-
# Testing mode flag
147-
const TESTING_MODE = Ref(false)
148146

149147
"""
150-
reset_defaults!()
148+
make_preferences_dynamic!()
151149
152-
**Internal function for testing only.** Enables testing mode where preferences
153-
are checked at runtime instead of using compile-time constants. This allows
154-
tests to verify that the preference system works correctly.
150+
**Internal function for testing only.** Makes preferences dynamic by redefining
151+
get_tuned_algorithm to check preferences at runtime instead of using compile-time
152+
constants. This allows tests to verify that the preference system works correctly.
155153
156154
!!! warning "Testing Only"
157155
This function is only intended for internal testing purposes. It modifies
158156
global state and should never be used in production code.
159157
"""
160-
function reset_defaults!()
158+
function make_preferences_dynamic!()
161159
# Redefine get_tuned_algorithm to use runtime preference checking for testing
162160
@eval function get_tuned_algorithm(::Type{eltype_A}, ::Type{eltype_b}, matrix_size::Integer) where {eltype_A, eltype_b}
163161
# Determine the element type to use for preference lookup

test/preferences.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ 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!()
5+
# Make preferences dynamic for testing verification
6+
LinearSolve.make_preferences_dynamic!()
77

88
# Clear any existing preferences to start clean
99
target_eltypes = ["Float32", "Float64", "ComplexF32", "ComplexF64"]

0 commit comments

Comments
 (0)