You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by Apache Bloodhound <bl...@incubator.apache.org> on 2013/03/16 21:39:55 UTC

[Apache Bloodhound] #469: Some batch modify unit test cases are failing

#469: Some batch modify unit test cases are failing
----------------------------------+--------------------
 Reporter:  rjollos               |      Owner:  nobody
     Type:  defect                |     Status:  new
 Priority:  major                 |  Milestone:
Component:  dashboard             |    Version:  0.4.0
 Keywords:  ITicketFieldProvider  |
----------------------------------+--------------------
 Several unit test cases in `trac.ticket.tests.batch.py` are failing. I've
 traced the failure of `test_add_batchmod_value_data_from_request` into
 `_get_new_ticket_values` , and
 `TicketSystem(self.env).get_ticket_fields()` is not returning `milestone`
 in the list due to the implementation of the in `ITicketFieldProvider`
 r1301116.

 {{{
 .EE....................E.
 ======================================================================
 ERROR: test_action_with_state_change (__main__.BatchModifyTestCase)
 Actions can have change status.
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "trac/ticket/tests/batch.py", line 224, in
 test_action_with_state_change
     self.assertFieldChanged(first_ticket_id, 'status', 'big')
   File "trac/ticket/tests/batch.py", line 30, in assertFieldChanged
     field_change = [c for c in changes if c[2] == field][0]
 IndexError: list index out of range

 ======================================================================
 ERROR: test_add_batchmod_value_data_from_request
 (__main__.BatchModifyTestCase)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "trac/ticket/tests/batch.py", line 73, in
 test_add_batchmod_value_data_from_request
     self.assertEqual(values['milestone'], 'milestone1')
 KeyError: 'milestone'

 ======================================================================
 ERROR: test_save_values (__main__.BatchModifyTestCase)
 Changed values are saved to all tickets.
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "trac/ticket/tests/batch.py", line 206, in test_save_values
     self.assertFieldChanged(first_ticket_id, 'component', 'bar')
   File "trac/ticket/tests/batch.py", line 30, in assertFieldChanged
     field_change = [c for c in changes if c[2] == field][0]
 IndexError: list index out of range

 ----------------------------------------------------------------------
 Ran 25 tests in 0.432s

 FAILED (errors=3)
 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/469>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #469: Some batch modify unit test cases are failing

Posted by Ryan Ollos <ry...@wandisco.com>.
On Mon, Mar 18, 2013 at 11:33 PM, Olemis Lang <ol...@gmail.com> wrote:

> On 3/18/13, Ryan Ollos <ry...@wandisco.com> wrote:
> > On Mon, Mar 18, 2013 at 1:36 PM, Apache Bloodhound <
> > bloodhound-dev@incubator.apache.org> wrote:
> >
> >> #469: Some batch modify unit test cases are failing
> >>
> [...]
> >>
> >> Comment:
> >>
> >>  [attachment:t469_r1457691_trac_test_batch_regression.diff Attached
> >> patch]
> >>  should fix this .
> >>
> >
> > Have you figured out already why the TicketSystem didn't need to be
> enabled
> > prior to the addition of ITicketFieldProvider? I'm just starting to look
> at
> > this, but it's not obvious to me so far.
> >
>
> Oh yes !
> Just because in Trac test suite instantiates `TicketSystem` class this
> way `TicketSystem(env)` rather than `env[TicketSystem]` . The former
> will *always* return the instance whereas the later also checks
> whether component class is enabled . Now , after introducing the
> interface and considering that `TicketSystem` itself is an implementor
> , then it will not be listed in the corresponding extension point and
> thereby «built-in» ticket fields will not be contributed .
>
> In practice , in order to make `TicketSystem` work it must be enabled
> ... so ... no defect in the SUT .


Thanks! It took me a while to wrap my head around why the TicketSystem
Component needed to be enabled in the test class, but your explanation
helped a lot. I'll commit the patch now.

Re: [Apache Bloodhound] #469: Some batch modify unit test cases are failing

Posted by Olemis Lang <ol...@gmail.com>.
On 3/18/13, Ryan Ollos <ry...@wandisco.com> wrote:
> On Mon, Mar 18, 2013 at 1:36 PM, Apache Bloodhound <
> bloodhound-dev@incubator.apache.org> wrote:
>
>> #469: Some batch modify unit test cases are failing
>>
[...]
>>
>> Comment:
>>
>>  [attachment:t469_r1457691_trac_test_batch_regression.diff Attached
>> patch]
>>  should fix this .
>>
>
> Have you figured out already why the TicketSystem didn't need to be enabled
> prior to the addition of ITicketFieldProvider? I'm just starting to look at
> this, but it's not obvious to me so far.
>

Oh yes !
Just because in Trac test suite instantiates `TicketSystem` class this
way `TicketSystem(env)` rather than `env[TicketSystem]` . The former
will *always* return the instance whereas the later also checks
whether component class is enabled . Now , after introducing the
interface and considering that `TicketSystem` itself is an implementor
, then it will not be listed in the corresponding extension point and
thereby «built-in» ticket fields will not be contributed .

In practice , in order to make `TicketSystem` work it must be enabled
... so ... no defect in the SUT .

-- 
Regards,

Olemis.

Re: [Apache Bloodhound] #469: Some batch modify unit test cases are failing

Posted by Ryan Ollos <ry...@wandisco.com>.
On Mon, Mar 18, 2013 at 1:36 PM, Apache Bloodhound <
bloodhound-dev@incubator.apache.org> wrote:

> #469: Some batch modify unit test cases are failing
> ------------------------+-----------------------------------------------
>   Reporter:  rjollos    |      Owner:  rjollos
>       Type:  defect     |     Status:  review
>   Priority:  blocker    |  Milestone:  Release 6
>  Component:  trac core  |    Version:  0.4.0
> Resolution:             |   Keywords:  ITicketFieldProvider ticket batch
> ------------------------+-----------------------------------------------
> Changes (by olemis):
>
>  * owner:  olemis => rjollos
>  * status:  accepted => review
>
>
> Comment:
>
>  [attachment:t469_r1457691_trac_test_batch_regression.diff Attached patch]
>  should fix this .
>

Have you figured out already why the TicketSystem didn't need to be enabled
prior to the addition of ITicketFieldProvider? I'm just starting to look at
this, but it's not obvious to me so far.

Re: [Apache Bloodhound] #469: Some batch modify unit test cases are failing

Posted by Ryan Ollos <ry...@wandisco.com>.
On Mon, Mar 18, 2013 at 3:17 PM, Olemis Lang <ol...@gmail.com> wrote:

> On 3/18/13, Ryan Ollos <ry...@wandisco.com> wrote:
> > On Mon, Mar 18, 2013 at 1:36 PM, Apache Bloodhound <
> > bloodhound-dev@incubator.apache.org> wrote:
> >
> >> #469: Some batch modify unit test cases are failing
> [...]
> >>  PS: I would not be sure of calling this a ''defect'' ...
> >
> >
> > Okay, thanks. I will take a look and push the change.
> >
>
> :)
>
> > As for calling it a defect, a change to Trac that breaks the unit tests
> > feels like it is introducing a defect (even though the original change
> was
> > part of an enhancement).
> >
>
> That's exactly the point . There's nothing wrong with the enhancement
> . Not to enable the ticket system is not exactly a defect in the SUT ,
> but more like a defective test case ... anyway ...


Right, it's a defect in the Bloodhound project, and the defect is that we
have failing test cases. I'm not saying there's a defect in the
implementation of ITicketFieldProvider, I'm saying there's a defect in our
project's test cases, introduced by the addition of ITicketFieldProvider.

Re: [Apache Bloodhound] #469: Some batch modify unit test cases are failing

Posted by Olemis Lang <ol...@gmail.com>.
On 3/18/13, Ryan Ollos <ry...@wandisco.com> wrote:
> On Mon, Mar 18, 2013 at 1:36 PM, Apache Bloodhound <
> bloodhound-dev@incubator.apache.org> wrote:
>
>> #469: Some batch modify unit test cases are failing
[...]
>>  PS: I would not be sure of calling this a ''defect'' ...
>
>
> Okay, thanks. I will take a look and push the change.
>

:)

> As for calling it a defect, a change to Trac that breaks the unit tests
> feels like it is introducing a defect (even though the original change was
> part of an enhancement).
>

That's exactly the point . There's nothing wrong with the enhancement
. Not to enable the ticket system is not exactly a defect in the SUT ,
but more like a defective test case ... anyway ...

-- 
Regards,

Olemis.

Re: [Apache Bloodhound] #469: Some batch modify unit test cases are failing

Posted by Ryan Ollos <ry...@wandisco.com>.
On Mon, Mar 18, 2013 at 1:36 PM, Apache Bloodhound <
bloodhound-dev@incubator.apache.org> wrote:

> #469: Some batch modify unit test cases are failing
> ------------------------+-----------------------------------------------
>   Reporter:  rjollos    |      Owner:  rjollos
>       Type:  defect     |     Status:  review
>   Priority:  blocker    |  Milestone:  Release 6
>  Component:  trac core  |    Version:  0.4.0
> Resolution:             |   Keywords:  ITicketFieldProvider ticket batch
> ------------------------+-----------------------------------------------
> Changes (by olemis):
>
>  * owner:  olemis => rjollos
>  * status:  accepted => review
>
>
> Comment:
>
>  [attachment:t469_r1457691_trac_test_batch_regression.diff Attached patch]
>  should fix this .
>
>  PS: I would not be sure of calling this a ''defect'' ...


Okay, thanks. I will take a look and push the change.

As for calling it a defect, a change to Trac that breaks the unit tests
feels like it is introducing a defect (even though the original change was
part of an enhancement).

Re: [Apache Bloodhound] #469: Some batch modify unit test cases are failing

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#469: Some batch modify unit test cases are failing
------------------------+-----------------------------------------------
  Reporter:  rjollos    |      Owner:  rjollos
      Type:  defect     |     Status:  review
  Priority:  blocker    |  Milestone:  Release 6
 Component:  trac core  |    Version:  0.4.0
Resolution:             |   Keywords:  ITicketFieldProvider ticket batch
------------------------+-----------------------------------------------
Changes (by olemis):

 * owner:  olemis => rjollos
 * status:  accepted => review


Comment:

 [attachment:t469_r1457691_trac_test_batch_regression.diff Attached patch]
 should fix this .

 PS: I would not be sure of calling this a ''defect'' ...

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/469#comment:2>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #469: Some batch modify unit test cases are failing

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#469: Some batch modify unit test cases are failing
------------------------+-----------------------------------------------
  Reporter:  rjollos    |      Owner:  rjollos
      Type:  defect     |     Status:  closed
  Priority:  blocker    |  Milestone:  Release 6
 Component:  trac core  |    Version:  0.4.0
Resolution:  fixed      |   Keywords:  ITicketFieldProvider ticket batch
------------------------+-----------------------------------------------
Changes (by rjollos):

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


Comment:

 (In [1460843])

 Fixes #469: Fix for failing `BatchModify` unit test cases. The
 `TicketSystem` implements the `ITicketFieldProvider` interface, and also
 calls a method of the `ITicketFieldProvider` interface to get a list
 containing the ticket fields. When the `api.TicketSystem` component is not
 enabled, the fields provided by that class won't be returned in the call
 `TicketSystem.get_ticket_fields`. The fields returned by
 `TicketSystem.get_select_fields` and `TicketSystem.get_radio_fields` are
 "built-in" ticket fields, which some cases expect to be returned through
 the call `TicketSystem.get_ticket_fields`.

 Thank to Olemis for the patch.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/469#comment:3>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #469: Some batch modify unit test cases are failing

Posted by Apache Bloodhound <bl...@incubator.apache.org>.
#469: Some batch modify unit test cases are failing
------------------------+-----------------------------------------------
  Reporter:  rjollos    |      Owner:  olemis
      Type:  defect     |     Status:  accepted
  Priority:  blocker    |  Milestone:  Release 6
 Component:  trac core  |    Version:  0.4.0
Resolution:             |   Keywords:  ITicketFieldProvider ticket batch
------------------------+-----------------------------------------------
Changes (by olemis):

 * status:  new => accepted
 * component:  dashboard => trac core
 * priority:  major => blocker
 * owner:  nobody => olemis
 * milestone:   => Release 6
 * keywords:  ITicketFieldProvider => ITicketFieldProvider ticket batch


Comment:

 Replying to [ticket:469 rjollos]:
 > Several unit test cases in `trac.ticket.tests.batch.py` are failing.
 I've traced the failure of `test_add_batchmod_value_data_from_request`
 into `_get_new_ticket_values` , and
 `TicketSystem(self.env).get_ticket_fields()` is not returning `milestone`
 in the list due to the implementation of the in `ITicketFieldProvider`
 r1301116.
 >
 [...]

 The same behavior can be reproduced in `bep_0003_multiproduct` branch for
 Trac test

 {{{
 #!sh

 $ python setup.py test -m tests.ticket.batch

 [...]

 ----------------------------------------------------------------------
 Ran 25 tests in 2.643s

 OK

 }}}

 /me wondering why ...

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/469#comment:1>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker

Re: [Apache Bloodhound] #469: Some batch modify unit test cases are failing

Posted by Ryan Ollos <ry...@wandisco.com>.
On Sat, Mar 16, 2013 at 1:39 PM, Apache Bloodhound <
bloodhound-dev@incubator.apache.org> wrote:

> #469: Some batch modify unit test cases are failing
> ----------------------------------+--------------------
>  Reporter:  rjollos               |      Owner:  nobody
>      Type:  defect                |     Status:  new
>  Priority:  major                 |  Milestone:
> Component:  dashboard             |    Version:  0.4.0
>  Keywords:  ITicketFieldProvider  |
> ----------------------------------+--------------------
>  Several unit test cases in `trac.ticket.tests.batch.py` are failing. I've
>  traced the failure of `test_add_batchmod_value_data_from_request` into
>  `_get_new_ticket_values` , and
>  `TicketSystem(self.env).get_ticket_fields()` is not returning `milestone`
>  in the list due to the implementation of the in `ITicketFieldProvider`
>  r1301116.
>
>  {{{
>  .EE....................E.
>  ======================================================================
>  ERROR: test_action_with_state_change (__main__.BatchModifyTestCase)
>  Actions can have change status.
>  ----------------------------------------------------------------------
>  Traceback (most recent call last):
>    File "trac/ticket/tests/batch.py", line 224, in
>  test_action_with_state_change
>      self.assertFieldChanged(first_ticket_id, 'status', 'big')
>    File "trac/ticket/tests/batch.py", line 30, in assertFieldChanged
>      field_change = [c for c in changes if c[2] == field][0]
>  IndexError: list index out of range
>
>  ======================================================================
>  ERROR: test_add_batchmod_value_data_from_request
>  (__main__.BatchModifyTestCase)
>  ----------------------------------------------------------------------
>  Traceback (most recent call last):
>    File "trac/ticket/tests/batch.py", line 73, in
>  test_add_batchmod_value_data_from_request
>      self.assertEqual(values['milestone'], 'milestone1')
>  KeyError: 'milestone'
>
>  ======================================================================
>  ERROR: test_save_values (__main__.BatchModifyTestCase)
>  Changed values are saved to all tickets.
>  ----------------------------------------------------------------------
>  Traceback (most recent call last):
>    File "trac/ticket/tests/batch.py", line 206, in test_save_values
>      self.assertFieldChanged(first_ticket_id, 'component', 'bar')
>    File "trac/ticket/tests/batch.py", line 30, in assertFieldChanged
>      field_change = [c for c in changes if c[2] == field][0]
>  IndexError: list index out of range
>
>  ----------------------------------------------------------------------
>  Ran 25 tests in 0.432s
>
>  FAILED (errors=3)
>  }}}


I'm not sure how to address this, but I haven't spent time digging into the
implementation of ITicketFieldProvider. It seems problematic to change the
behavior of `TicketSystem.get_ticket_fields` as it could break plugins and
other parts of Trac.