How funny Alex,

I had to solve the exact same problem last week. Our snippet looks similar
as well.

See my tests/__init__.py:    http://gist.github.com/125670

- Didip -

On Wed, Jun 10, 2009 at 12:24 AM, Alexandre Conrad <
[email protected]> wrote:

>
> Hi,
>
> Thanks for your replies. This comforts me and I'll keep on doing my
> work like that then.
>
> I think that when a Pylons project is created with SQLAlchemy support,
> there should be a "unit" directory (in contrast of "functional") under
> "tests/" which can be ready to be used for SA model unit testing. What
> do you think ?
>
> Here's my setup:
>
> http://paste.pocoo.org/show/122154/
>
> In this snippet shows that a "TestModel" class is created under in
> "tests/__init__.py", which can be inherited by test scripts under
> "tests/unit/test_super_model.py": class TestSuperModel(TestModel): ...
>
> The "tests/test_models.py" then becomes pretty much useless (anyway,
> it's empty). I wouldn't want to have all my model testing in a single
> file.
>
> Regards,
> Alex
>
> 2009/6/9 Didip Kerabat <[email protected]>:
> > Almost all of my tests are in model-layer because I tend to push as push
> > logic as possible in models.
> >
> > That approach makes unit testing simpler, IMHO.
> >
> > - Didip -
> >
> > On Tue, Jun 9, 2009 at 2:20 AM, Alexandre Conrad
> > <[email protected]> wrote:
> >>
> >> Dear Pylonauts,
> >>
> >> I'm starting a new project and I thought it was a good time to setup
> >> tests, something I have never done before. Because I'm writing models
> >> (SQLAlchemy objects) before my controllers, I have created a
> >> tests/units folder under which I'm testing my models, in a
> >> straightforward manner, no WebOb.
> >>
> >> But one may argue that unit testing at such low level shouldn't be
> >> required as the higher tests/functional level should cover all
> >> requirements as this is what is exposed to the outside world and only
> >> that exposed part will manipulate the web app. So unit testing may
> >> lead to over-testing, which is as well arguable as it takes time to
> >> update and maintain.
> >>
> >> On the other hand, I tend to think that the functional tests may get
> >> into your way when testing, such as logging and how "environ" may
> >> alter the behavior of controllers. Of course, a setUpClass()
> >> classmethod at the class level could prepare these things, but it's
> >> more work and I feel that I have less control as functional tests call
> >> controllers, which are black boxes.
> >>
> >> I am *not* saying that functional tests shouldn't be done. I just want
> >> to test my models and functional tests may get into my way. But do I
> >> need to test my models so finely?
> >>
> >> How do you have your tests done?
> >>
> >> Regards,
> >> Alex
> >>
> >>
> >
> >
> > >
> >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to