Skip to content

[Question] An incomprehensible question about test view . #848

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
625781186 opened this issue Jun 15, 2020 · 6 comments
Closed

[Question] An incomprehensible question about test view . #848

625781186 opened this issue Jun 15, 2020 · 6 comments
Labels

Comments

@625781186
Copy link

code

image

Both functions were successfully tested independently :

image
image

image

image

But the second one will fail when I test the whole class :

image

image

image

I don't know why .

@625781186
Copy link
Author

625781186 commented Jun 15, 2020

supplement

image

image

The second query set is empty

@625781186
Copy link
Author

supplement 2 :

image

Comment the # @pytest.mark.usefixtures('live_server') , Both functions were successfully tested independently .

image

@625781186
Copy link
Author

And if I use @pytest.mark.django_db(transaction=True) , exactly the same error occurred :

image

@625781186
Copy link
Author

I think the same #329

@625781186
Copy link
Author

https://stackoverflow.com/questions/56549271/pytest-and-django-transactional-database

I seem to have missed writing db , so the database was emptied after the first test case.

@bluetech
Copy link
Member

So the question is indeed a bit incomprehensible 😁 But it seems like you found a solution, so I'll close this. Let me know if not.

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