diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-08-22 12:01:35 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-08-22 14:46:32 -0700 |
commit | 3fe43d7dfd9228771daca82789295cceb5f37854 (patch) | |
tree | 647baab19fd398d3e4ff238d1cf2ebd12659b097 /tests | |
parent | 0f5dcac8dd61564c8e575ee13e5a04324320b10d (diff) |
alot/helper: Fix call_cmd_async polluting global environment
An assignment `e = os.environ` creates a reference not a copy, which
means that modifying one necessarily modifies the other. Using
`dict.copy` creates a shallow copy (the keys and values are references,
but the dicts are different objects), which means only modifications to
mutable objects are shared. In the case of os.environ which only
contains immutable objects like strings, bools, and numbers this isn't
an issue.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/helper_test.py | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/tests/helper_test.py b/tests/helper_test.py index d7b11164..c2927725 100644 --- a/tests/helper_test.py +++ b/tests/helper_test.py @@ -451,7 +451,6 @@ class TestCallCmdAsync(unittest.TestCase): env={'foo': 'bar'}) self.assertEqual(ret, 'bar') - @utilities.expected_failure @inlineCallbacks def test_env_doesnt_pollute(self): with mock.patch.dict(os.environ, {}, clear=True): |