Skip to content

Commit

Permalink
Settings should not alter the initial dict.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémy HUBSCHER committed Feb 17, 2017
1 parent 1073903 commit 0edf02b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions pyramid/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def Settings(d=None, _environ_=os.environ, **kw):
keyword args)."""
if d is None:
d = {}
d = dict(d)
d.update(**kw)

eget = _environ_.get
Expand Down
6 changes: 3 additions & 3 deletions pyramid/tests/test_config/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def test__set_settings_as_None(self):
settings = config._set_settings(None)
self.assertTrue(settings)

def test__set_settings_uses_original_dict(self):
def test__set_settings_does_not_uses_original_dict(self):
config = self._makeOne()
dummy = {}
result = config._set_settings(dummy)
self.assertTrue(dummy is result)
self.assertEqual(dummy['pyramid.debug_all'], False)
self.assertTrue(dummy is not result)
self.assertNotIn('pyramid.debug_all', dummy)

def test__set_settings_as_dictwithvalues(self):
config = self._makeOne()
Expand Down

0 comments on commit 0edf02b

Please sign in to comment.