after grasping that the pylons-docs are a good way to understand how to deal
with TG2, I took a look at the unit-testing for my planned authentication
wrapping.
Now a problem seems to be that nosetests don't find the *.ini properly, and
that the generate controller_test is hard-coded to use development.ini
instead of test.ini.
So I had to change
config
= 'config:'+(os.path.abspath(os.path.basename(__name__)+'/../../development.ini#main'))
to
config
= 'config:'+(os.path.abspath(os.path.basename(__name__)+'/../../test.ini#main'))
in tests/test_controllers.
I also have to run the tests doing
nosetests -sw tests/
otherwise nose complains with
ERROR: Failure: OSError (File '/home/dir/projects/ableton/Web/test.ini' not
found)
which seems to stem from nose not setting the CWD as expected by the above
code. A solution would be to look from CWD upwards to where the test.ini is
found (if any...) instead of hard-coding the ../../
So - shall I create a ticket for this? And possibly even a patch?
Generally, what about DB-tests? I helped myself doing
class TestTGController:
def test_index(self):
import authenticationtest.model
m = authenticationtest.model
m.metadata.create_all()
(code that obviously will need to go into setUp, I'm just in the middle of
working my way through this)
but shouldn't we supply some base-class that does that?
Diez
I think there was a desire to port the work that was done on creating
a WebTest based testutil module for 1.5 to tg2, and now that the 1.5
testing story is finished, we should look at this much more closely.
--Mark
--
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog
I think you might have misunderstood. The problem is that the freshly
generated tests
- look for development.ini instead of test.ini
- don't find it unless told in a rather special way
> As far as database tests are concerned, take a look at:
> http://pythontutorials.googlecode.com/svn/tutorials/barbershop/ In
> that project I set up a test framework which shows how to use sqlite
> to test the database.
Will do, thanks. Still this needs to become part of TG2 I think.
Diez