-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Tests: make RelativeSession transaction aware. [7.x.x] #1227
Tests: make RelativeSession transaction aware. [7.x.x] #1227
Conversation
This should fix some random test failures. Fixes #1018 Summary of my latest comments there: - In a functional test layer using zope.testbrowser, a request that changes something in Plone leads to a transaction commit. - plone.restapi uses RelativeSession instead, and this missed such an integration: changes did not really end up in the database. It somehow mostly worked so far, but to me that seems luck.
This comment has been minimized.
This comment has been minimized.
@jenkins-plone-org please run jobs |
@jenkins-plone-org please run jobs |
When I have some time I'll take a look at this PR but I don't think it fixes #1018. The big question I have is: Why only happens in Python 2? I don't think commit issues are related to Python 2. |
@mauritsvanrees as I expect, this PR didn't fix #1018. See: https://github.com/plone/plone.restapi/pull/1227/checks?check_run_id=3603953265 I'm wondering if these changes are really necessary. The tests in Python 3 work fine. And the tests in Python 2 also work well, apart from the problems of #1018. I removed the lines: plone.restapi/src/plone/restapi/tests/test_services_types.py Lines 55 to 62 in 4bca687
and the tests failed as expected. I tend to think that these changes are not necessary. |
I tend to think that they are needed and make sense. I think this change can help when you do a |
Can you please create a branch and create a test like this, showing that it fails? |
Just comment out
This does not actually use |
I can confirm that by commenting out this line the test fails. I even substitutes to use Wouldn't these changes make a test include in others? I've had problems committing in a test and objects created in a test appeared in other tests. It would be nice to do a cleanup of transaction.begin and transaction.commit, which would no longer be needed. And check on Jenkins. |
Another thing that should be taken into account: For performance reasons, wouldn't it be better to call the commit when necessary, as it's being done today, rather than every request? |
Every request should already do a commit automatically. But somehow there is discrepancy between what the request sees and what is actually synced to the database. It is rather strange, and failures are not deterministic. We may need to call transaction begin/commit/sync more often, but is hard for me to say when and where. I see a Maybe we should add a |
This should fix some random test failures.
This fixes #1018
Summary of my latest comments there:
It somehow mostly worked so far, but to me that seems luck.
Once approved, I can forward port to master.