Skip to content
This repository has been archived by the owner on Jan 14, 2019. It is now read-only.

Test only models? #19

Closed
AdrianLC opened this issue Sep 15, 2013 · 3 comments
Closed

Test only models? #19

AdrianLC opened this issue Sep 15, 2013 · 3 comments

Comments

@AdrianLC
Copy link

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
Copy link

carljm commented Sep 16, 2013

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.

@carljm carljm closed this as completed Sep 16, 2013
@jezdez
Copy link
Owner

jezdez commented Sep 16, 2013

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

@carljm
Copy link

carljm commented Sep 27, 2013

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants