This is an automated email from the ASF dual-hosted git repository. cgivre pushed a commit to branch feat/drill-mcp-server in repository https://gitbox.apache.org/repos/asf/drill-mcp.git
commit 2d7855ad600ccadb6d4aa67f6bbd68029bfccfa8 Author: cgivre <[email protected]> AuthorDate: Tue Aug 11 15:28:24 2026 -0400 test: isolate config tests from ambient DRILL_* env vars, add numeric-string coercion test --- tests/test_config.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 34c66fb..e8527d0 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -5,7 +5,7 @@ from drill_mcp.config import Config, ConfigError, load_config def test_defaults_are_conservative(): - cfg = load_config() + cfg = load_config(env={}) assert cfg.url == "http://localhost:8047" assert cfg.backend == "rest" assert cfg.auth == "none" @@ -18,12 +18,19 @@ def test_defaults_are_conservative(): def test_loads_from_yaml_file(tmp_path): path = tmp_path / "drill.yaml" path.write_text("url: http://drill:8047\nmax_rows: 50\nwritable_plugins: [dfs.tmp]\n") - cfg = load_config(str(path)) + cfg = load_config(str(path), env={}) assert cfg.url == "http://drill:8047" assert cfg.max_rows == 50 assert cfg.writable_plugins == ["dfs.tmp"] +def test_loads_numeric_string_from_yaml_file(tmp_path): + path = tmp_path / "drill.yaml" + path.write_text('max_rows: "50"\n') + cfg = load_config(str(path), env={}) + assert cfg.max_rows == 50 + + def test_env_overrides_file(tmp_path): path = tmp_path / "drill.yaml" path.write_text("url: http://from-file:8047\n") @@ -49,35 +56,35 @@ def test_unknown_key_is_an_error(tmp_path): path = tmp_path / "drill.yaml" path.write_text("uurl: http://typo:8047\n") with pytest.raises(ConfigError, match="uurl"): - load_config(str(path)) + load_config(str(path), env={}) def test_basic_auth_requires_credentials(): with pytest.raises(ConfigError, match="user"): - load_config(overrides={"auth": "basic"}) + load_config(env={}, overrides={"auth": "basic"}) def test_jdbc_backend_requires_driver_path(): with pytest.raises(ConfigError, match="jdbc_driver_path"): - load_config(overrides={"backend": "jdbc"}) + load_config(env={}, overrides={"backend": "jdbc"}) def test_invalid_backend_is_an_error(): with pytest.raises(ConfigError): - load_config(overrides={"backend": "carrier-pigeon"}) + load_config(env={}, overrides={"backend": "carrier-pigeon"}) def test_max_rows_must_be_positive(): with pytest.raises(ConfigError): - load_config(overrides={"max_rows": 0}) + load_config(env={}, overrides={"max_rows": 0}) def test_missing_config_file_is_an_error(): with pytest.raises(ConfigError, match="not found"): - load_config("/nonexistent/drill.yaml") + load_config("/nonexistent/drill.yaml", env={}) def test_config_is_immutable(): - cfg = load_config() + cfg = load_config(env={}) with pytest.raises(ValidationError, match="frozen"): cfg.url = "http://elsewhere:8047"
