On Fri, Nov 5, 2010 at 8:18 AM, Alex Gaynor <alex.gay...@gmail.com> wrote: > On Thu, Nov 4, 2010 at 8:14 PM, Russell Keith-Magee > <russ...@keith-magee.com> wrote: >> So - tl;dr. love the idea. However, we need to handle the edge cases >> if it's going to be added to Django trunk, and replacing Django's own >> usage of the ad-hoc pattern is as good a test as any that we've >> tackled the edge cases. > > I think it's a little cavalier to see what we do is ad-hoc. Sure > there are a bunch of tests with: > > def setUp(self): > self.old_SETTING = getattr(settings, "SETING", _missing) > > def tearDown(self): > if self.old_SETTING is _missing: > del settings.SETTING" > else: > settings.SETTING = self.old_SETTING > > but how else would you write that? That's the whole point of setUp > and tearDown, and I can't think of a more succinct formulation of that > that covers all of the cases (assign/reset attribute, append/insert, > set env variable, etc.).
Ad hoc is from the Latin "For this". Ad-hoc doens't mean the pattern is bad or wrong, it just means it isn't generalized. We manually reproduce variations of the pattern you describe every time we need it, rather than having a generalized framework level tool for handling settings. I think "ad hoc" is a pretty apt description of what Django's test suite does. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.