functional tests in tg2

View: New views
3 Messages — Rating Filter:   Alert me  

functional tests in tg2

by Alessandro Molina-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,
I'm actually trying to write functional tests for a complex web application.

I'm unable to write tests as they don't setup correctly the model.
I have a websetup.py that creates the schema by calling
model.metadata.create_all(bind=config['pylons.app_globals'].sa_engine) and
then checks if some groups in tg_group already exist, if they don't it creates
them.

When I call paster setup-app development.ini everything works as expected

When the test suite calls websetup.py from TestController.setUp the
websetup.py fails when checking for the existing groups saying that
"(OperationalError) no such table: tg_group" even if the line before was the
metadata.create_all call.

My test.ini has the default configuration.
I think that I'm missing something, but I'm unable to find some extensive doc
about tests in TG2.

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


Re: functional tests in tg2

by Alessandro Molina-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Thursday 22 October 2009 15:09:23 Alessandro Molina wrote:
> When the test suite calls websetup.py from TestController.setUp the
> websetup.py fails when checking for the existing groups saying that
> "(OperationalError) no such table: tg_group" even if the line before was
> the metadata.create_all call.

I also have to say that if I change

sqlalchemy.url = sqlite:///:memory:

to

sqlalchemy.url = sqlite:///foobar.db

in test.ini
everything works as expected. But I should be able to make tests work also on
memory db

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


Re: functional tests in tg2

by James-93 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I'm seeing similar behaviour: I have two test methods in a class. Each
method completes successfully when run in isolation, but when I run
them both as a suite, I get "no such table" exceptions.

In the same way as the OP, the suite passes as expected when I use a
sqlite file database, rather than in-memory.

Does anyone have any ideas? I don't seem to be doing anything
particularly odd in websetup.py or setUp methods...

Thanks!
James

On Oct 22, 1:13 pm, Alessandro Molina <alessandro.mol...@...>
wrote:

> On Thursday 22 October 2009 15:09:23 Alessandro Molina wrote:
>
> > When thetestsuite calls websetup.py from TestController.setUp the
> > websetup.py fails when checking for the existing groups saying that
> > "(OperationalError)no such table: tg_group" even if the line before was
> > the metadata.create_all call.
>
> I also have to say that if I change
>
> sqlalchemy.url = sqlite:///:memory:
>
> to
>
> sqlalchemy.url = sqlite:///foobar.db
>
> intest.ini
> everything works as expected. But I should be able to make tests work also on
> memory db
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbogears@...
To unsubscribe from this group, send email to turbogears+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---