homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients benjamin.peterson, bethard, brian.curtin, denversc, eric.araujo, eric.smith, r.david.murray
Date 2010年08月11日.15:06:11
SpamBayes Score 3.220919e-07
Marked as misclassified No
Message-id <1281539174.76.0.00635361320247.issue9553@psf.upfronthosting.co.za>
In-reply-to
Content
Your code is fine (though to my tastes a bit verbose...if it were me I'd just put the code in the setUp and tearDown methods and hardcode 'COLUMNS' (it isn't like the name COLUMNS is going to change)...but that's just personal style).
The EnviormentVarGuard version would look like this (untested):
 def setUp(self):
 self.guard = EnvironmentVarGuard()
 self.environ = self.guard.__enter__()
 # Current tests expect 80 column terminal width.
 self.environ['COLUMNS'] = 80
 def tearDown(self):
 self.guard.__exit__(None, None, None)
You could of course delete COLUMNS as you did, but I thought setting it to 80 would be more explicit.
Another comment about the patch: by inspection it appears that adding setUp and tearDown to TestCase isn't enough, since subclasses and mixins define those without calling the superclass versions.
History
Date User Action Args
2010年08月11日 15:06:15r.david.murraysetrecipients: + r.david.murray, bethard, eric.smith, benjamin.peterson, eric.araujo, brian.curtin, denversc
2010年08月11日 15:06:14r.david.murraysetmessageid: <1281539174.76.0.00635361320247.issue9553@psf.upfronthosting.co.za>
2010年08月11日 15:06:12r.david.murraylinkissue9553 messages
2010年08月11日 15:06:11r.david.murraycreate

AltStyle によって変換されたページ (->オリジナル) /