diff --git a/septentrion/runner.py b/septentrion/runner.py index 3c12c7d..1a65fd8 100644 --- a/septentrion/runner.py +++ b/septentrion/runner.py @@ -38,7 +38,7 @@ def _env(self): "PGUSER": self.settings.USERNAME, "PGPASSWORD": self.settings.PASSWORD, } - return {key: value for key, value in environment.items() if value} + return {key: str(value) for key, value in environment.items() if value} def _run_simple(self): diff --git a/tests/integration/test_runner.py b/tests/integration/test_runner.py index c6aa5ca..fba4c38 100644 --- a/tests/integration/test_runner.py +++ b/tests/integration/test_runner.py @@ -58,6 +58,18 @@ def test_run_psql_not_found(run_script, env): ) +def test_run_integer_in_settings(db, settings_factory, env, tmp_path): + settings = settings_factory(**db) + # settings are noew stringified to prevent subprocess.run + # crashing while building the appropriate command line. + settings.PORT = 5432 + path = tmp_path / "script.sql" + path.write_text("SELECT 1;") + with io.open(path, "r", encoding="utf8") as f: + script = Script(settings, f, path) + script.run() + + def test_run_with_meta_loop(db, settings_factory, run_script): settings = settings_factory(**db)