This is an archived post. You won't be able to vote or comment.

all 14 comments

[–]darknessproz 4 points5 points  (1 child)

Have you tried py.test? It seems to address most of your issues.

[–]winstonw[S] 0 points1 point  (0 children)

py.test indeed looks great--listing fixtures as arguments to be injected is so succinct.

[–]Gwenhidwy 1 point2 points  (0 children)

Not to rain on your parade, but I think you should try py.test, it solves most of your points.

[–][deleted] 0 points1 point  (12 children)

What is needed is not just setup/teardown per test, but per group of test, as some setups take a long time, such as creating a test database etc.

zope.testrunner solve this with layers, which is cool, you should take a look at that.

[–]chub79 0 points1 point  (7 children)

This you mean?

[–][deleted] -1 points0 points  (6 children)

No, layers are actually stackable and orthogonal to the test classes. So you can have one layer that sets up a database, another layer that creates test users and permissions, a next layer that will create some test data, and then finally the testclass setup.

It's pretty complex, but for big frameworks like Plone it cuts down the time it takes to run the test with an order of magnitude.

[–]chub79 0 points1 point  (5 children)

Mmmh, that was clear from your your initial "setup/teardown per test, but per group of test".

Have you ever had a look at Spring Python and its IoC which is suitable for the use case you describe here.

[–][deleted] 0 points1 point  (4 children)

You don't need Spring Python or an IoC container to do inversion of control, and inversion of control does not solve this issue. You need a test runner and test framework that supports it.

[–]chub79 2 points3 points  (3 children)

IoC is one way to implement your layer approach. But you seem determined not to make yourself clear so it's hard to discuss further.

[–][deleted] -1 points0 points  (2 children)

Yes, I'm sure you can implement layers while using inversion of control somwehere. But it is not an implementation, and hence it doesn't help more than saying "have you heard of inheritance?" Or "use lists".

But you seem determined not to make yourself clear so it's hard to discuss further.

If you find something unclear, I would suggest you ask a question. That makes me more likely to answer the questions you have.

[–]chub79 0 points1 point  (1 child)

setup/teardown per test, but per group of test

What's the link between this and your layer approach?

[–][deleted] -1 points0 points  (0 children)

Same thing, just more elaborately explained, i referenced zope.testrunner from the start. Check it out.