Skip to content

Commit 39304d7

Browse files
timsaucerclaude
andcommitted
File the SessionConfig tests with the other SessionConfig tests
The two `SessionConfig.set` tests went into `test_plans.py` because they were committed alongside the `execute` bounds check, not because they have anything to do with plans. `test_context.py` is where `SessionConfig` construction is already covered, and it now also holds the three constructor tests for the other half of the same panic defect. Move them there, ahead of the constructor cases so the method they refer back to is read first, and fold the duplicated note about `PanicException` deriving from `BaseException` into the first of the five. `test_plans.py` keeps its `SessionConfig` import for the `with_target_partitions` calls in the partitioning tests. No assertion changed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 874f7b6 commit 39304d7

2 files changed

Lines changed: 20 additions & 23 deletions

File tree

python/tests/test_context.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,26 @@ def test_create_context_with_all_valid_args():
103103
ctx.catalog("datafusion")
104104

105105

106+
def test_session_config_set_rejects_an_unknown_namespace():
107+
"""A bad config key raises rather than aborting through a Rust panic.
108+
109+
`datafusion.runtime.*` appears in `information_schema.df_settings` but has
110+
no `ConfigOptions` namespace, so it is the key a naive "read the settings
111+
back and replay them on the worker" loop hits first.
112+
"""
113+
# `ValueError`, not a bare `Exception`: a panic would arrive as
114+
# `PanicException`, which derives from `BaseException` and so would not be
115+
# caught here at all. Both this and the constructor cases below rely on it.
116+
with pytest.raises(ValueError, match="runtime"):
117+
SessionConfig().set("datafusion.runtime.memory_limit", "unlimited")
118+
119+
120+
def test_session_config_set_rejects_an_unparsable_value():
121+
"""A well-known key with a value of the wrong type raises too."""
122+
with pytest.raises(ValueError, match="batch_size"):
123+
SessionConfig().set("datafusion.execution.batch_size", "not_an_int")
124+
125+
106126
def test_session_config_constructor_applies_options():
107127
"""A dict passed to the constructor reaches the session's options."""
108128
config = SessionConfig(
@@ -130,9 +150,6 @@ def test_session_config_constructor_rejects_an_unknown_namespace():
130150
131151
The same defect as `SessionConfig.set` had, reached through the argument
132152
that a replayed `information_schema.df_settings` dictionary arrives in.
133-
`ValueError`, not a bare `Exception`: a panic would arrive as
134-
`PanicException`, which derives from `BaseException` and so would not be
135-
caught here at all.
136153
"""
137154
with pytest.raises(ValueError, match="runtime"):
138155
SessionConfig({"datafusion.runtime.memory_limit": "unlimited"})

python/tests/test_plans.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -269,26 +269,6 @@ def test_physical_partitioning_equality_is_structural() -> None:
269269
assert len({scan, other_scan, grouped}) == 2
270270

271271

272-
def test_session_config_set_rejects_an_unknown_namespace() -> None:
273-
"""A bad config key raises rather than aborting through a Rust panic.
274-
275-
`datafusion.runtime.*` appears in `information_schema.df_settings` but has
276-
no `ConfigOptions` namespace, so it is the key a naive "read the settings
277-
back and replay them on the worker" loop hits first.
278-
"""
279-
# `ValueError`, not a bare `Exception`: a panic would arrive as
280-
# `PanicException`, which derives from `BaseException` and so would not be
281-
# caught here at all.
282-
with pytest.raises(ValueError, match="runtime"):
283-
SessionConfig().set("datafusion.runtime.memory_limit", "unlimited")
284-
285-
286-
def test_session_config_set_rejects_an_unparsable_value() -> None:
287-
"""A well-known key with a value of the wrong type raises too."""
288-
with pytest.raises(ValueError, match="batch_size"):
289-
SessionConfig().set("datafusion.execution.batch_size", "not_an_int")
290-
291-
292272
def test_installing_a_physical_codec_preserves_strict_mode() -> None:
293273
"""Installing a physical extension codec must not re-enable inlining.
294274

0 commit comments

Comments
 (0)