Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn if developer tries to commit transaction in an integration testing layer #6

Open
davisagli opened this issue Feb 14, 2014 · 4 comments

Comments

@davisagli
Copy link
Member

Tell them to use a functional layer instead.

We can do this by patching transaction.commit or by adding a transaction resource manager that always fails on commit. Whatever we set up in the integration layer, the functional layer needs to take down.

@mauritsvanrees
Copy link
Member

This is in plone.testing (not plone.app.testing) 5.0.0.

@iham
Copy link
Member

iham commented May 16, 2019

not sure, but ...

i came across this years later - obviously - and stumbled a lot.

the error tells me the testisolation is broken ... ok.
but thats it.

as this error depends on which layer i use - FunctionalTesting or IntegrationTesting, it would be awesome if there would be a hint like "use a functional test", as @davisagli stated.

i came across this issue searching for docs about transaction.commit() and testisolation and nothing i found dipped my nose into a pile of wisdom, except for this closed issue.

but i don't know if this is an issue for plone.app.testing or plone.testing.

@iham iham reopened this May 16, 2019
@mauritsvanrees
Copy link
Member

At the time, I apparently thought the message was clear. But it can indeed be clearer. Currently it says:

TestIsolationBroken: You are in a Test Layer
(IntegrationTesting) that is fast by just aborting transactions between each
test. You just committed something. That breaks the test isolation. So I stop
here and let you fix it.

We could mention the options of removing the transaction commit or use a functional layer. This would need a change in plone.testing, in zope.py and zserver.py.

Could you create a PR?

@iham
Copy link
Member

iham commented May 22, 2019

@mauritsvanrees not right at this moment, but i will fix this asap.

thank you pointing me to the code-parts! <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants