Re: [Django] #28320: Parallel testing: Please implement a signal or call checks after test DB creation but before cloning it.

2017-06-17 Thread Django
#28320: Parallel testing: Please implement a signal or call checks after test DB
creation but before cloning it.
-+-
 Reporter:  László Károlyi   |Owner:  nobody
 Type:   |   Status:  closed
  Cleanup/optimization   |
Component:  Testing framework|  Version:  1.11
 Severity:  Normal   |   Resolution:  duplicate
 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 László Károlyi):

 * status:  new => closed
 * resolution:   => duplicate


Comment:

 Replying to [comment:2 Tim Graham]:
 > Can we close this ticket then?

 I think so, yes. Thx, closing.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.37c8353e9a7df37b19d39360fdfff7bc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28320: Parallel testing: Please implement a signal or call checks after test DB creation but before cloning it.

2017-06-17 Thread Django
#28320: Parallel testing: Please implement a signal or call checks after test DB
creation but before cloning it.
-+-
 Reporter:  László Károlyi   |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Testing framework|  Version:  1.11
 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
-+-

Comment (by Tim Graham):

 #15610 and #16281 might be related to the contenttypes issue. Can we close
 this ticket then? If there's some issue with contenttypes, it's likely
 more clear to open a separate ticket about that.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.0319f14575a7b7ed18bb3b67d892dfda%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28320: Parallel testing: Please implement a signal or call checks after test DB creation but before cloning it.

2017-06-17 Thread Django
#28320: Parallel testing: Please implement a signal or call checks after test DB
creation but before cloning it.
-+-
 Reporter:  László Károlyi   |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Testing framework|  Version:  1.11
 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
-+-

Comment (by László Károlyi):

 Update:

 It seems I managed to consistently insert the needed data into the DB
 before it gets cloned by subclassing the testrunner and running checks
 before `setup_databases()` runs. But that brought another problem I
 discovered, and which maybe could be fixed.

 So the first part I'm doing at startup is, I update my own permission
 models, which subclass the original django `Permission` model. Formerly, I
 had a function that would give a `ContentType` model of
 `django.contrib.auth`:
 {{{#!python
 def _get_perm_contenttype(app_label: str, model_name: str):
 """
 Return a `ContentType`.
 """
 from django.contrib.contenttypes.models import ContentType
 return ContentType.objects.get_for_model(
 apps.get_model(app_label=app_label, model_name=model_name))
 }}}

 Because `ContentType.objects.get_for_model()` caches, and because the
 nature of the parallel testing, that cached result sometimes brought
 models with wrong `ID`s, and I got constraint violations because no such
 IDs existed in my DB.

 I fixed my code by not using `get_for_model()`, and using `get()` instead.
 I'm just leaving this information here for your consideration.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.3f631739ad79b81ae61f4eea61e1b96a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #28320: Parallel testing: Please implement a signal or call checks after test DB creation but before cloning it.

2017-06-17 Thread Django
#28320: Parallel testing: Please implement a signal or call checks after test DB
creation but before cloning it.
+
   Reporter:  László Károlyi|  Owner:  nobody
   Type:  Cleanup/optimization  | Status:  new
  Component:  Testing framework |Version:  1.11
   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 |
+
 Hi,

 I tried to reach someone on IRC, but actually it's better to document my
 issue here, maybe there will be a solution to it eventually.

 I'm trying to use the new and shiny parallel testing functionality of
 Django 1.11, and I've run into problems with it.

 So I have functionality implemented on `check` and the `post_migrate`
 signal, where I conditionally insert stuff into the DB that can't be
 inserted by fixtures, and also conditionally modify DB fields that can't
 be done from the ORM. (the latter is basically changing collation on a
 column)

 It seems that the post_migrate signal is run randomly before and after the
 test creation, and checks are only run *after* the DB is cloned, so I
 don't have a sufficient point where I can have my logic run.

 Monkey-patching has shown that the best solution would be to run
 `call_command('check')`
 [https://github.com/django/django/blob/master/django/test/utils.py#L178
 here], so basically after `create_test_db` but before `clone_test_db`.

 I can quickly add that, but I'm not sure how it could be tested, and what
 implications it would have, so I'm asking you guys, if you think it's
 doable and feasible. Because of this right now, I can't use parallel
 testing.

--
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.43e6a76188c3a571f14b5ebeac6ad931%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.