Re: [Django] #12089: test client fails to collect sub-contexts

2013-08-29 Thread Django
#12089: test client fails to collect sub-contexts
-+-
 Reporter:  akaihola |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Testing framework|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  template context | Triage Stage:  Accepted
  TestClient |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by timo):

 * needs_better_patch:  0 => 1


-- 
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/066.366afe8e41e3e5a70ec6150ac7757e3e%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Django] #12089: test client fails to collect sub-contexts

2013-03-23 Thread Django
#12089: test client fails to collect sub-contexts
-+-
 Reporter:  akaihola |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Testing framework|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  template context | Triage Stage:  Accepted
  TestClient |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by aaugustin):

 * stage:  Design decision needed => Accepted


Comment:

 Accepting based on Russell's comments. The approach of the current patch
 is rejected, a backwards-compatible approach such as the one proposed in
 comment 12 must be found.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #12089: test client fails to collect sub-contexts

2010-02-05 Thread Django
#12089: test client fails to collect sub-contexts
-+--
  Reporter:  akaihola| Owner:  nobody   
  
Status:  new | Milestone:   
  
 Component:  Testing framework   |   Version:  SVN  
  
Resolution:  |  Keywords:  template context 
TestClient
 Stage:  Design decision needed  | Has_patch:  1
  
Needs_docs:  0   |   Needs_tests:  0
  
Needs_better_patch:  0   |  
-+--
Comment (by russellm):

 IMHO, Backwards incompatibilities in test suites are even *more* important
 than backwards incompatibilities in production code. If updating your
 Django version can cause large portions of your test suite to fail, you
 still have the problem of working out if the problem is failures in your
 code, or in your tests.

 (3) is probably my preferred option of the 4 you mention, but I'm still
 not completely sold.

 Thinking out loud - it strikes me that a 'sub context' should actually be
 collected as a 'sub'. That is, if you inspect context[3], and it generated
 2 subcontexts, you should be able to inspect context[3].context[0]. I
 haven't even begun to look into the practicalities of this; I'm just
 throwing out ideas that make sense to me from a public API point of view.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #12089: test client fails to collect sub-contexts

2010-02-05 Thread Django
#12089: test client fails to collect sub-contexts
-+--
  Reporter:  akaihola| Owner:  nobody   
  
Status:  new | Milestone:   
  
 Component:  Testing framework   |   Version:  SVN  
  
Resolution:  |  Keywords:  template context 
TestClient
 Stage:  Design decision needed  | Has_patch:  1
  
Needs_docs:  0   |   Needs_tests:  0
  
Needs_better_patch:  0   |  
-+--
Comment (by akaihola):

 Replying to [comment:10 russellm]:
 > I can see what you're trying to do, and the patch makes sense - my
 concern is the potential for backwards incompatibility. Any template that
 has a 'with' and 'include' will suddenly acquire a whole lot more contexts
 in the test output; if you're testing the number of contexts, or if the
 subcontext introduces a variable that wasn't previously being tested
 against, you could start to get test failures (or worse, false passes).

 Ok. What about these alternatives:

  1. point out the current behavior in the documentation
  2. provide a test client option to activate collecting sub-contexts
  3. add an additional `response.deep_context` attribute and do complete
 context collection with sub-contexts there
  4. wait until Django 2.0 and make this change then

 How severe is backwards incompatibility in the test framework? It wouldn't
 break production websites after all.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #12089: test client fails to collect sub-contexts

2010-02-04 Thread Django
#12089: test client fails to collect sub-contexts
-+--
  Reporter:  akaihola| Owner:  nobody   
  
Status:  new | Milestone:   
  
 Component:  Testing framework   |   Version:  SVN  
  
Resolution:  |  Keywords:  template context 
TestClient
 Stage:  Design decision needed  | Has_patch:  1
  
Needs_docs:  0   |   Needs_tests:  0
  
Needs_better_patch:  0   |  
-+--
Changes (by russellm):

  * stage:  Unreviewed => Design decision needed

Comment:

 I can see what you're trying to do, and the patch makes sense - my concern
 is the potential for backwards incompatibility. Any template that has a
 'with' and 'include' will suddenly acquire a whole lot more contexts in
 the test output; if you're testing the number of contexts, or if the
 subcontext introduces a variable that wasn't previously being tested
 against, you could start to get test failures (or worse, false passes).

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #12089: test client fails to collect sub-contexts

2009-12-04 Thread Django
#12089: test client fails to collect sub-contexts
+---
  Reporter:  akaihola   | Owner:  nobody
 
Status:  new| Milestone:
 
 Component:  Testing framework  |   Version:  SVN   
 
Resolution: |  Keywords:  template context 
TestClient
 Stage:  Unreviewed | Has_patch:  1 
 
Needs_docs:  0  |   Needs_tests:  0 
 
Needs_better_patch:  0  |  
+---
Comment (by akaihola):

 Replying to [comment:8 anonymous]:
 > Any other workarounds? because I want to track the SVN closely.

 Rebasing with trunk has worked so well that I haven't considered other
 options. It would be trivial to subclass `django.test.Client` and override
 `request()` to use the patched version of `store_rendered_templates()`.
 However, then you might miss changes in trunk to the `request()` method.
 In that sense forking and rebasing is a better alternative.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #12089: test client fails to collect sub-contexts

2009-12-01 Thread Django
#12089: test client fails to collect sub-contexts
+---
  Reporter:  akaihola   | Owner:  nobody
 
Status:  new| Milestone:
 
 Component:  Testing framework  |   Version:  SVN   
 
Resolution: |  Keywords:  template context 
TestClient
 Stage:  Unreviewed | Has_patch:  1 
 
Needs_docs:  0  |   Needs_tests:  0 
 
Needs_better_patch:  0  |  
+---
Comment (by anonymous):

 Replying to [comment:6 akaihola]:
 > Replying to [comment:5 anonymous]:
 > > any update on this or roadmap ?
 >
 > I'm running my own fork while waiting for a review by a core developer,
 and I haven't brought this up on the IRC channel or the mailing lists.
 Does your own fork use the patch in this ticket ?

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #12089: test client fails to collect sub-contexts

2009-12-01 Thread Django
#12089: test client fails to collect sub-contexts
+---
  Reporter:  akaihola   | Owner:  nobody
 
Status:  new| Milestone:
 
 Component:  Testing framework  |   Version:  SVN   
 
Resolution: |  Keywords:  template context 
TestClient
 Stage:  Unreviewed | Has_patch:  1 
 
Needs_docs:  0  |   Needs_tests:  0 
 
Needs_better_patch:  0  |  
+---
Changes (by akaihola):

  * keywords:  => template context TestClient

Comment:

 Replying to [comment:5 anonymous]:
 > any update on this or roadmap ?

 I'm running my own fork while waiting for a review by a core developer,
 and I haven't brought this up on the IRC channel or the mailing lists.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #12089: test client fails to collect sub-contexts

2009-11-30 Thread Django
#12089: test client fails to collect sub-contexts
+---
  Reporter:  akaihola   | Owner:  nobody
Status:  new| Milestone:
 Component:  Testing framework  |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Comment (by anonymous):

 any update on this or roadmap ?

 I just found this bug while running a Django TestCase that calls a view
 which renders a template with a templatetag that has takes_context = True.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #12089: test client fails to collect sub-contexts

2009-10-29 Thread Django
#12089: test client fails to collect sub-contexts
+---
  Reporter:  akaihola   | Owner:  nobody
Status:  new| Milestone:
 Component:  Testing framework  |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by akaihola):

  * needs_better_patch:  1 => 0

Comment:

 One thing to note in the v2 patch is that it assumes that all items of
 `context.dicts` have the `copy()` method. Normally they do as they are
 `dict`s.

 In one of my projects I was erroneously calling
 {{{
 render_to_string('template.html', Context({...}))
 }}}
 while the second argument is expected to be a plain dict. This works
 because a `Context` object behaves similarly enough to a dict, but the
 patched test client crashed since `Context` has no `copy()` method.

 One could maybe imagine valid reasons to build a context out of
 `dict`-like objects which aren't real `dict`s and might lack a
 `copy()` method.  Should the test client use more bare-bones `dict`
 methods to make copies of the context to make sure this is as
 backwards compatible as possible?

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #12089: test client fails to collect sub-contexts

2009-10-28 Thread Django
#12089: test client fails to collect sub-contexts
+---
  Reporter:  akaihola   | Owner:  nobody
Status:  new| Milestone:
 Component:  Testing framework  |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  1  |  
+---
Comment (by akaihola):

 Replying to [comment:2 akaihola]:
 > There's a problem in the `deepcopy` approach. I'm trying to understand
 why it makes a test fail and come up with a better patch.

 The problem was with `Template` objects in the context on debug pages.
 Such context were not `deepcopy`able. The more manual copying approach in
 the second version of the patch fixes this problem.

 I also included a test case for this issue.

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #12089: test client fails to collect sub-contexts

2009-10-28 Thread Django
#12089: test client fails to collect sub-contexts
+---
  Reporter:  akaihola   | Owner:  nobody
Status:  new| Milestone:
 Component:  Testing framework  |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  1  |  
+---
Changes (by akaihola):

  * needs_better_patch:  0 => 1

Comment:

 There's a problem in the `deepcopy` approach. I'm trying to understand why
 it makes a test fail and come up with a better patch.

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #12089: test client fails to collect sub-contexts

2009-10-26 Thread Django
#12089: test client fails to collect sub-contexts
+---
  Reporter:  akaihola   | Owner:  nobody
Status:  new| Milestone:
 Component:  Testing framework  |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by akaihola):

  * needs_better_patch:  => 0
  * has_patch:  0 => 1
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 The problem was that the same context object was appended to the
 `ContextList` over and over, and if I understand correctly, when the
 pushed contexts got popped, modified context was forgotten. At least
 `response.context` contained a list of multiple references to a single
 `RequestContext` object when I examined it with the debugger.

 The above patch makes deep copies of the `RequestContext` objects before
 adding them to the `ContextList` of the test client.

 Tests are included with the patch. The two template files shown as
 `/dev/null` by Trac (apparently it doesn't understand Git's diff format)
 are `/tests/templates/testclient/sub.html` and
 `/tests/templates/testclient/super.html`, respectively.

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #12089: test client fails to collect sub-contexts

2009-10-26 Thread Django
#12089: test client fails to collect sub-contexts
---+
 Reporter:  akaihola   |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Testing framework  | Version:  SVN   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 If a main template renders a sub-template with a modified or newly created
 context, test client's `response.context` fails to include the modified
 context. An example using `{% with %}` and `{% include %}`:

 === main-template.html ===
 {{{
 {% with "some-value" as subvariable %}
   {% include sub-template.html %}
 {% endwith %}
 }}}

 === sub-template.html ===
 {{{
 The value of subvariable is "{{ subvariable }}".
 }}}

 If the test client requests a view which renders `main-template.html`, the
 variable `subvariable` can't be found in `response.context` as returned by
 `TestClient.get()`.

 The same happens if a custom template tag creates a new context and
 renders another template.

-- 
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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---