[p2pu-dev] Current testing setup -- Lernanta

Jos Flores josmasflores at gmail.com
Mon Jun 25 12:28:02 UTC 2012


Dirk, that sounds good. I've seen some of the current tests but I'm
not sure test_utils is doing all that much for them; in any case,
mysql for dev sounds great for the reasons you mention, but I wouldn't
like to have to run tests against msyql unless there is a way to
separate tests that touch the DB and tests that do not.
I want my tests to run in seconds (or less) and cannot do that with
mysql. Jenkins can do that, full blown production setup, many times a
day, so if there is something wrong you know asap; but for my dev env
I'd rather use an in-memory DB for testing (even if local dev is also
mysql). But anyway, that is just personal preference.

Discussion about an overall strategy sounds good. My main goal right
now would be to have enough tests to allow for refactoring. You
mentioned in another thread that changing a simple attribute name is a
nightmare; views and models are very coupled, and models in themselves
are both django models and business logic, all mixed up. I don't even
want to talk about the views, after a couple of hours looking at the
learn stuff in the projects view... don't think I'll be able to sleep
tonight! :P :D

cheers,
Jose

On 25 June 2012 12:44, Dirk Uys <dirk at p2pu.org> wrote:
> Hi Jose.
>
> We do use the current testing to some extent. Every app in lernanta should
> have a test.py file containing at least one class with a bunch of methods
> used for testing. How those methods are used and what they test aren't that
> clearly defined. Some of them test the models while others test the views.
>
> Testing views tends to be messy - for some tests you need to parse the HTML
> and validate the contents. Maybe we can somehow emulate the way that flask
> and pyramid apply templates using a decorator. Then we can test the views
> without having to parse the HTML.
>
> I run the current tests without FORCE_DB, but I'm not using the sqlite
> database anymore. I decided a while ago to switch to mysql for my own
> development so that I'm running a setup closer to production.
>
> I'm not overly attached to the current way that testing happens. I've played
> a bit with selenium to do testing and also with some python scripts using
> urllib and beautifulsoup.
>
> Maybe we should discuss a little how our overall testing strategy should
> look?
>
> Cheers
> d
>
> On Sun, Jun 24, 2012 at 1:17 AM, Jos Flores <josmasflores at gmail.com> wrote:
>>
>> A bit more digging into the current setup.
>>
>> I cannot make any tests pass without passing in
>> FORCE_DB=whatever_value_you_want_here
>>
>> Passing FORCE_DB nullifies the supposedly speed gains that test_utils
>> provide. So this library is actually creating a bunch of dependencies
>> (at least Jinja, but probably nose too) and providing no benefit
>> whatsoever... can anyone please correct me if I'm wrong?
>>
>> cheers,
>> Jose
>>
>>
>>
>> On 23 June 2012 23:01, Jos Flores <josmasflores at gmail.com> wrote:
>> > Hi guys,
>> >
>> > thinking about ways to improve test coverage overall, and wondering...
>> > how attached are we to the current testing setup?
>> >
>> > I know little about testing django apps, but I can see that test_utils
>> > kinda takes over the test runner.
>> > I see a bunch of DB tests, which are cool, but not what I was
>> > expecting to see. There are no unit tests (as in isolated tests) that
>> > I can find, and I'd like to target that first, and create tests with
>> > every bug fix I work on from now own.
>> >
>> > Not sure about nose either. So my main question (again) would be, how
>> > attached are we to test_utils and nose?
>> > It's quite possible the setup was inherited from batucada and no one
>> > knows very well what's going on. If that is the case, can you please
>> > let me know :)
>> >
>> > cheers,
>> > Jose
>> _______________________________________________
>> p2pu-dev mailing list
>> p2pu-dev at lists.p2pu.org
>> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>
>
>
> _______________________________________________
> p2pu-dev mailing list
> p2pu-dev at lists.p2pu.org
> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>


More information about the p2pu-dev mailing list