Opened 10 years ago
Closed 10 years ago
#22980 closed Bug (invalid)
Timing issue with testing and custom Querysets
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Testing framework | Version: | 1.7-rc-1 |
Severity: | Normal | Keywords: | testing querysets |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If you run two identical tests while using a custom queryset method, all test access to the same queryset seems fail (same or different views). The view returns and empty queryset.
This repo is a full project just to reproduce the bug and has notes on how to get it to pass in different ways. If I am an idiot, I'm sorry. This manifested in a large project and I stripped it down to what it is now which is the bare minimum.
https://github.com/adamrt/django-queryset-issues
Django 1.6.5 and 1.7c1
Python 2.7.3 and 2.7.5
MaxOS X 10.9 and Ubuntu 12.04
PostgreSQL and SQLite3
Change History (3)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
I apologize for the AppRegistryNotReady error. I was between 1.7c1 and 1.6.5 with the manager/queryset situation and requirements.txt. I have no problem just overriding get queryset. Just seemed like unusual behavior to me but it's not a big deal to me.
Just trying to do my part. The app seemed so minimal that it seemed like other people had to be hitting the same issue but I couldn't find it anywhere.
Feel free to close this ticket if you are satisfied, as I will just override get_queryset.
Thanks!
comment:3 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
The issue is that passing callable arguments to querysets doesn't really work as you might expect. We've actually deprecated doing so in 1.7 (see f1b3ab9c2158f5a7da113aef4158499ce2d42ee2). I think that'll clear up the confusion.
I couldn't run your project out of the box (
AppRegistryNotReady
exception), but I had no problems after the following modification:Could you test it?