[Django] #29559: TransactionTestCase.reset_sequences doesn't reset sequences of auto created ManyToMany models

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #29559: TransactionTestCase.reset_sequences doesn't reset sequences of auto created ManyToMany models

Django
#29559: TransactionTestCase.reset_sequences doesn't reset sequences of auto created
ManyToMany models
---------------------------------------------+------------------------
               Reporter:  Oliver Sauder      |          Owner:  nobody
                   Type:  Bug                |         Status:  new
              Component:  Testing framework  |        Version:  master
               Severity:  Normal             |       Keywords:
           Triage Stage:  Unreviewed         |      Has patch:  0
    Needs documentation:  0                  |    Needs tests:  0
Patch needs improvement:  0                  |  Easy pickings:  0
                  UI/UX:  0                  |
---------------------------------------------+------------------------
 Consider following example:

 {{{
 class Person(models.Model):
     first_name = models.CharField(max_length=20)
     last_name = models.CharField(max_length=20)

     friends = models.ManyToManyField('self')

 class AutoIncrementResetTest(TransactionTestCase):
     reset_sequences = True

     def test_autoincrement_reset1(self):
         p = Person.objects.create(first_name='Jack', last_name='Smith')
         self.assertEqual(p.pk, 1)

         p.friends.add(Person.objects.create(first_name='Jacky',
 last_name='Smith'))
         self.assertEqual(p.friends.through.objects.first().pk, 1)

     def test_autoincrement_reset2(self):
         p = Person.objects.create(first_name='Jack', last_name='Smith')
         self.assertEqual(p.pk, 1)

         p.friends.add(Person.objects.create(first_name='Jacky',
 last_name='Smith'))
         self.assertEqual(p.friends.through.objects.first().pk, 1)
 }}}

 Test **test_autoincrement_reset2** will fail with a much higher primary
 key, indicating that sequence has not been properly reset. Tested this on
 a Postgres database but I assume this error exist on other databases as
 well.

--
Ticket URL: <https://code.djangoproject.com/ticket/29559>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.cf058b066b77ae36d95621d995d0612e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29559: TransactionTestCase.reset_sequences doesn't reset sequences of auto created ManyToMany models

Django
#29559: TransactionTestCase.reset_sequences doesn't reset sequences of auto created
ManyToMany models
-------------------------------------+-------------------------------------
     Reporter:  Oliver Sauder        |                    Owner:  Oliver
                                     |  Sauder
         Type:  Bug                  |                   Status:  assigned
    Component:  Testing framework    |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Oliver Sauder):

 * owner:  nobody => Oliver Sauder
 * status:  new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/29559#comment:1>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.8c78789180bf2897295048bae797d584%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29559: TransactionTestCase.reset_sequences doesn't reset sequences of auto created ManyToMany models

Django
In reply to this post by Django
#29559: TransactionTestCase.reset_sequences doesn't reset sequences of auto created
ManyToMany models
-------------------------------------+-------------------------------------
     Reporter:  Oliver Sauder        |                    Owner:  Oliver
                                     |  Sauder
         Type:  Bug                  |                   Status:  assigned
    Component:  Testing framework    |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Oliver Sauder):

 * has_patch:  0 => 1


Comment:

 [https://github.com/django/django/pull/10174 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/29559#comment:2>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.697cef57c7c0958953c16173cf95cc80%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29559: TransactionTestCase.reset_sequences doesn't reset sequences of auto created ManyToMany models

Django
In reply to this post by Django
#29559: TransactionTestCase.reset_sequences doesn't reset sequences of auto created
ManyToMany models
-------------------------------------+-------------------------------------
     Reporter:  Oliver Sauder        |                    Owner:  Oliver
                                     |  Sauder
         Type:  Bug                  |                   Status:  assigned
    Component:  Testing framework    |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

 * stage:  Unreviewed => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/29559#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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.69be5f15a817dab6d86a442a2eab1955%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #29559: TransactionTestCase.reset_sequences doesn't reset sequences of auto created ManyToMany models

Django
In reply to this post by Django
#29559: TransactionTestCase.reset_sequences doesn't reset sequences of auto created
ManyToMany models
-------------------------------------+-------------------------------------
     Reporter:  Oliver Sauder        |                    Owner:  Oliver
                                     |  Sauder
         Type:  Bug                  |                   Status:  closed
    Component:  Testing framework    |                  Version:  master
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"a07a49ee3295061f384d98d520a565658dd064b8" a07a49ee]:
 {{{
 #!CommitTicketReference repository=""
 revision="a07a49ee3295061f384d98d520a565658dd064b8"
 Fixed #29559 -- Fixed TransactionTestCase.reset_sequences for auto-created
 m2m through models.
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29559#comment:4>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.df190a0bd7d2d29f86e24c1e307190fa%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.