Another problem with tests in TG 2.3

8 views
Skip to first unread message

Christoph Zwerschke

unread,
Jun 18, 2013, 2:36:19 PM6/18/13
to TurboGears Trunk
I found another problem when running tests for a quickstarted project
with SQLAlchemy:

The test application is only loaded in TestController.setUp() which is
only run when the test methods in tests/functional run. When you run
only the tests in tests/model, then the application is not loaded, the
config is empty and setup_db will throw an error.

I guess this problem has not been noticed in TG 2.2 because when you run
the complete test suite, tests/functional runs before tests/model, so
everything is fine, and additionally the nose plugin that was included
in Pylons made sure that the configuration was loaded before running the
tests. Since we do not use that plugin any more in TG 2.3, we should be
more careful about the proper setup. I'll refactor the test templates a
bit today to make the setup process cleaner.

-- Christoph

Jorge Vargas

unread,
Jun 18, 2013, 2:39:21 PM6/18/13
to turbogears-trunk

That's what the other tests you found broken were supposed to prevent

--
You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turbogears-trunk+unsubscribe@googlegroups.com.
To post to this group, send email to turbogears-trunk@googlegroups.com.
Visit this group at http://groups.google.com/group/turbogears-trunk.
For more options, visit https://groups.google.com/groups/opt_out.


Christoph Zwerschke

unread,
Jun 18, 2013, 3:15:49 PM6/18/13
to turbogea...@googlegroups.com
Am 18.06.2013 20:39, schrieb Jorge Vargas:
> That's what the other tests you found broken were supposed to prevent

Yes, I'll try to create a replacement for these as well.

-- Christoph

Alessandro Molina

unread,
Jun 18, 2013, 4:38:11 PM6/18/13
to tg-trunk
Missed that as the test suite in a whole works, I should have spent more time on the devtools, apart from migrating the comands I took for granted that the other parts worked as they didn't require changes since 2.2 :/
Anyway I'm pretty sure that test_pastetemplate would have not found it anyway as it just looks for the index and login page and runs the same testsuite that is already available.

Craig Small

unread,
Jun 18, 2013, 6:27:43 PM6/18/13
to turbogea...@googlegroups.com
On Tue, Jun 18, 2013 at 08:36:19PM +0200, Christoph Zwerschke wrote:
> The test application is only loaded in TestController.setUp() which
> is only run when the test methods in tests/functional run. When you
> run only the tests in tests/model, then the application is not
> loaded, the config is empty and setup_db will throw an error.
Oh, I thought that was done on purpose. I hit that problem when testing
things outside the controllers that need models to operate. I basically
copied some of the code across to make my own setup but fixing it right
would be a better idea.

- Craig
--
Craig Small VK2XLZ http://enc.com.au/ csmall at : enc.com.au
Debian GNU/Linux http://www.debian.org/ csmall at : debian.org
GPG fingerprint: 5D2F B320 B825 D939 04D2 0519 3938 F96B DF50 FEA5

Christoph Zwerschke

unread,
Jun 19, 2013, 3:35:02 AM6/19/13
to turbogea...@googlegroups.com
Am 19.06.2013 00:27, schrieb Craig Small:
> Oh, I thought that was done on purpose. I hit that problem when testing
> things outside the controllers that need models to operate. I basically
> copied some of the code across to make my own setup but fixing it right
> would be a better idea.

It is fixed in the development branch now.

-- Christoph

Reply all
Reply to author
Forward
0 new messages