jezdez / django-discover-runner

A Django test runner based on unittest2's test discovery.
http://pypi.python.org/pypi/django-discover-runner
Other
132 stars 13 forks source link

Test only models? #19

Closed AdrianLC closed 11 years ago

AdrianLC commented 11 years ago

Hello,

Where can I setup a model for tests only? (For testing abstract models)

In django 1.5 (without installing this app, obviously), I can define the model in tests.py. With django-nose models defined in test files are installed automatically as well.

Does the discover-runner support this in any way? Without explicitly calling syncdb from the tests?

Thank you!

carljm commented 11 years ago

Hi,

No, there isn't really any solution for this in discover-runner. There isn't really in Django core, either - the ability to put models in tests.py is an accident of the current implementation, not a supported feature. There is an open feature request for it, and support from several core developers, so it just needs someone to pick it up and champion a proper solution: https://code.djangoproject.com/ticket/7835

Closing this because I think it's an issue for Django core, not discover-runner.

jezdez commented 11 years ago

Thanks @carljm, I agree, this isn't a feature request this app should handle.

carljm commented 11 years ago

FWIW, I just tested this in the context of looking into https://code.djangoproject.com/ticket/21164, and it seems that the discover runner still supports installing models located in test files (and its still an accident of implementation, not an intended feature). The only difference is the one observed in that ticket, which is that not all the same tests will necessarily be run with the discover runner, therefore not all the same test-only models will be discovered and installed.