Skip to content

fix: save_config stringifies JSON before writing - #110

Open
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:codequality/bobber-save-config-stringifies-json-before
Open

fix: save_config stringifies JSON before writing#110
andrewwhitecdw wants to merge 1 commit into
NVIDIA:mainfrom
andrewwhitecdw:codequality/bobber-save-config-stringifies-json-before

Conversation

@andrewwhitecdw

Copy link
Copy Markdown

This PR addresses the following issue in bobber/bobber.py: save_config stringifies JSON before writing.

Changes

  • bobber/bobber.py: save_config stringifies JSON before writing.

Details

--- a/bobber/bobber.py
+++ b/bobber/bobber.py
@@ -1,1 +1,1 @@
-        fp.write(json.dumps(settings))
+        json.dump(settings, fp)

Tests

  • tests/test_bobber_save_config.py
--- /dev/null
+++ b/tests/test_bobber_save_config.py
@@ -0,0 +1,15 @@
+import unittest
+from argparse import Namespace
+from unittest.mock import mock_open, patch
+import bobber.bobber as bobber_module
+
+
+class TestSaveConfig(unittest.TestCase):
+    def test_save_config_uses_json_dump(self):
+        args = Namespace(log_path='/tmp', command='run')
+        with patch('builtins.open', mock_open()), \
+             patch.object(bobber_module.json, 'dump') as dump_mock:
+            bobber_module.save_config(args)
+        dump_mock.assert_called_once()

Contributor guidelines

Per this repo's CONTRIBUTING.md:

  • All commits are signed off (Signed-off-by trailer, DCO).

Signed-off-by: Andrew White <andrewh@cdw.com>
@andrewwhitecdw

Copy link
Copy Markdown
Author

Closing per adversarial audit: branch contains off-scope or not-a-bug changes.

@andrewwhitecdw
andrewwhitecdw deleted the codequality/bobber-save-config-stringifies-json-before branch August 2, 2026 14:04
@andrewwhitecdw
andrewwhitecdw restored the codequality/bobber-save-config-stringifies-json-before branch August 17, 2026 20:32
@andrewwhitecdw

Copy link
Copy Markdown
Author

script closed on accident

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant