[TIP] TiP BoF feedback & call for help
gary.bernhardt at gmail.com
Tue Mar 15 14:15:45 PDT 2011
On Mon, Mar 14, 2011 at 12:11 PM, Jorge Vargas <jorge.vargas at gmail.com> wrote:
> So who is wrong? me? us? jenkins? django? unittest ? Who to blame ?
> I'll love to run my tests more but 30 minutes feedback is just crazy.
I pretty much agree with everything that's been said. I'd summarize as:
- Django's encouragement of tight coupling can lead to slow tests.
- But, Django isn't *making* you write slow tests; it's just making
them easy. It's possible to write fast tests in Django.
- The test runner probably isn't related to your problem.
- Parallelizing can treat the symptom temporarily, but will allow the
core problem to continue getting worse.
- Writing more focused tests with mocks will solve your current problem.
- But, if you use too many mocks too fast, or use them without
thinking carefully, it'll bite you down the road.
- And, if you write huge classes/functions and test them with mocks,
the combination of bad design and isolated tests will make changing
your system hard.
Here are some things to think about: How can you pull the logic in
your app out of your views and models, into separate classes? Once you
do that, how can you test those classes without passing any Django
objects (models, requests, etc.) into them? Answering those questions
will be a good start. :)
More information about the testing-in-python