Previously Alexandre Conrad 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 ?

In my opinion  the whole standard test setup Pylons installs should be
different :). Currently importing package.tests has side-effects such as
invoking websetup, which is a bit nasty; importing should never have
side-effects imho, and this one is particularly invasive. 
The test case base class defined in tests/__init__.py is also a
functional test case and should be moved into the tests/functional/
directory. 

My test setup for Pylons projects looks like this:

* tests/__init__.py is empty
* tests/base.py has three minimal test case classes: a class which only
  configures SQLAlchemy, a class which only sets up a minimal Pylons
  environment (with mock session, cache, etc. in the environ), and a
  class which combines those two. If useful this file also has some
  utility functions that can be called by test methods to create some
  standard initial data.
* tests/test*.py contain all the unit tests
* tests/functional/__init__.py is empty
* tests/functional/base.py contains the Pylons setup logic, and is
  pretty much the standard Pylons tests/__init__.py moved to this
  location
* tests/functional/test*.py contain all the functional tests

I tend to only do unittests for models and utility functions, and use
both unittests and functional tests for controllers.

Wichert.

-- 
Wichert Akkerman <[email protected]>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.

--~--~---------~--~----~------------~-------~--~----~
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