Skip to content

Test case using transaction aren't isolated on the non default databases #286

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

Closed
xordoquy opened this issue Oct 15, 2015 · 10 comments
Closed
Labels

Comments

@xordoquy
Copy link

This is a regression I have with pytest-django 2.9 - doesn't happen with 2.8. Django is 1.7.1, py.test 2.8.2 and Python 3.4.
Some of my tests are using transactions and aren't run in isolation to each other any longer. They are part of a unittest.TestCase.
Performing a git bisect, the commit 0ec741b seems to introduce the regression.

This is probably due to the fact that it now only applies rollbacks to Django TestCase and no more with unittest's ones.

@blueyed
Copy link
Contributor

blueyed commented Oct 15, 2015

So it is about transactional_db, right?

@xordoquy
Copy link
Author

indeed, sorry, should have mentioned it.

@blueyed
Copy link
Contributor

blueyed commented Oct 15, 2015

Thanks for notifying us, and bisecting it.

Can you come up with a test case, based on the existing ones?
I would have thought that this is tested already, but we're not using transactions in there then probably.

@blueyed blueyed added the bug label Oct 15, 2015
@xordoquy
Copy link
Author

ah, sorry, I'm confusing terms.
I don't use the transactional_db feature. The file is marked as pytest.mark.django_db(transaction=True)

@xordoquy
Copy link
Author

Will try to get a test case for it though won't be able to work on this before next week.

@blueyed
Copy link
Contributor

blueyed commented Oct 15, 2015

I don't use the transactional_db feature. The file is marked as pytest.mark.django_db(transaction=True)

That is quite the same though, just another way to mark/express it.

@xordoquy
Copy link
Author

OK, I've been trying to reproduce the issue but failed.
I've probably missed a point in my initial analysis. The real project uses a multi database configuration and the secondary databases aren't rolled back. It's not the use of unittest.TestCase that causes this isolation issue.

Will try to get a failing test case but it'll be slightly more complex.

Edit: I changed the title to reflect this.

@xordoquy xordoquy changed the title Test case using transaction aren't isolated Test case using transaction aren't isolated on the non default databases Oct 30, 2015
@blueyed
Copy link
Contributor

blueyed commented Oct 30, 2015

@xordoquy
Thanks for reporting back.
It would be sweet nonetheless to have some extra test to make sure it works as expected, in case it's not tested for already. Please let us know about your findings and keep that (contributing extra tests) in mind.

@xordoquy
Copy link
Author

@blueyed that's on my todo list. Could find some time to work on this today, I was just reporting back.

@bluetech
Copy link
Member

bluetech commented May 7, 2021

Closing this issue as it's probably no longer relevant.

@bluetech bluetech closed this as completed May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants