#37175: Add database backend methods to get hardcoded or nonexistent primary key
values for tests
-------------------------------------+-------------------------------------
Reporter: Tim | Owner: Tim Graham
Graham |
Type: New | Status: assigned
feature |
Component: Database | Version: dev
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
While hardcoding primary key values in the Django test suite is avoided as
much as possible, sometimes there are legitimate uses. The existing
hardcoded integer values, however, don't work on databases that don't use
integer primary key values. For example, MongoDB uses `DEFAULT_AUTO_FIELD
= "django_mongodb_backend.fields.ObjectIdAutoField"`.
I propose adding new methods `DatabaseOperations.get_hardcoded_pk()` and
`get_nonexistentd_pk()` to allow a database backend to provide suitable
values, minimizing the size of the Django fork needed for running the test
suite on such databases.
--
Ticket URL: <https://code.djangoproject.com/ticket/37175>
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 view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019ed257a89b-87727da1-1c53-4395-9ee3-0f5640560190-000000%40eu-central-1.amazonses.com.