#25046: Initial SQL scripts (not data) for testing
-------------------------------------+-------------------------------------
Reporter: liwee | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: 1.8
Severity: Normal | Resolution:
Keywords: testing view | Triage Stage:
create_test_db | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by liwee):
The view script can be quite long, please see attached file. I keep the
sql view script just above the relevant model in model.py. The
contrib.admin takes cares of the UI. If a view change is required, I run
the drop / create view script directly within the database, correcting
errors I see on the spot.
[https://docs.djangoproject.com/en/1.8/howto/initial-data/]
''If you require data for a test case, you should add it using either a
test fixture, or programmatically add it during the setUp() of your test
case.''
I wasn't aware that another method exist in RunSQL, thank you. To
summarize, I would need to export the view schema from the live database,
save the file, read the file and pass the contents to RunSQL to fake a
migration whenever I need to test my views. Would all these excessive
migration cause a problem? Is there anything wrong with my interpretation
of RunSQL?
It just seems cleaner if I can get create_test_db to read the exported
view schema directly or perhaps for create_test_db to extract the view
schema directly from the live database.
--
Ticket URL: <https://code.djangoproject.com/ticket/25046#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.33c5cac75c35b689bcb739f7234803ba%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.