24 + saved_user_encoding = osutils._cached_user_encoding 25 + saved_stdout = sys.stdout 26 + def restore_stuff(): 27 + osutils._cached_user_encoding = saved_user_encoding 28 + sys.stdout = saved_stdout 29 + self.addCleanup(restore_stuff)
You missed the even simpler:
self.overrideAttr(sys, 'stdout') self.overrideAttr(osutils._cached_user_encoding)
which will set an illegal value that could even catch invalid tests there.
And looking at the tests, you don't even need to override sys.stdout anyway.
Hmm, your branch seems to be based on a bzr version that doesn't provide overrideAttr, yet you target bzr.dev, is that really wanted ?
=== modified file 'bzrlib/tests/test_http.py'
Same remarks, plus it will conflict with my lealing-tests proposal, but I'll handle the conflicts there (I've addressed the same problem :)
This is still better than what we have so feel free to land whatever version you want, my vote is optional Tweak here :)
« Back to merge proposal
24 + saved_user_encoding = osutils. _cached_ user_encoding _cached_ user_encoding = saved_user_encoding (restore_ stuff)
25 + saved_stdout = sys.stdout
26 + def restore_stuff():
27 + osutils.
28 + sys.stdout = saved_stdout
29 + self.addCleanup
You missed the even simpler:
self.overrideAt tr(sys, 'stdout') tr(osutils. _cached_ user_encoding)
self.overrideAt
which will set an illegal value that could even catch invalid tests there.
And looking at the tests, you don't even need to override sys.stdout anyway.
Hmm, your branch seems to be based on a bzr version that doesn't provide overrideAttr,
yet you target bzr.dev, is that really wanted ?
=== modified file 'bzrlib/ tests/test_ http.py'
Same remarks, plus it will conflict with my lealing-tests proposal, but I'll handle the conflicts there (I've addressed the same problem :)
This is still better than what we have so feel free to land whatever version you want, my vote is optional Tweak here :)