select_single is inconsistent with select_many

Bug #1225692 reported by Thomi Richards
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Autopilot
Fix Released
High
Unassigned
autopilot (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

The select_many method returns an empty list when it cannot find any objects that match the specified criteria. This means we get an IndexError exception when test authors write code like this:

thing1, thing2 = app.select_many('Things')

When select_many returns an unexpected number of items, this causes the test to fail (although we should probably be more explicit in the case where nothing was returned.)

select_single, however, returns None. This leads to ugly test code like this:

foo = self.app.select_single('SomeWidget')
self.assertThat(foo, NotEquals(None))
bar = foo.select_single('SomeOtherWidget')
self.assertThat(bar, NotEquals(None))

If we made select_single raise the StateNotFoundError exception, these assertion lines wouldn't be needed any more.

Related branches

description: updated
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:autopilot/1.3 at revision 328, scheduled for release in autopilot, milestone Unknown

Changed in autopilot:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package autopilot - 1.3.1+13.10.20130918-0ubuntu1

---------------
autopilot (1.3.1+13.10.20130918-0ubuntu1) saucy; urgency=low

  [ Jean-Baptiste Lallement ]
  * Added autopilot-sandbox-run to run autopilot tests in a 'fake' X
    server. Xephyr and Xvfb are supported. (LP: #1226070)

  [ Thomi Richards ]
  * kzgdiparg ugp srgp s r ua. (LP: #1205204)
  * Add support for click packages. (LP: #1212833)
  * Update StateNotFoundErrror exception to give more informative
    messages. (LP: #1225701)
  * Fix select_single inconsistency. (LP: #1225692)
  * Create wait_select_single method. (LP: #1223428)
  * Add test case for applications that exit with SIGABRT when launched
    with autopilot.
  * Back out changes that would break test case compatibility. (LP:
    #1226505)
  * Performance improvments for launching and closing applications under
    test with autopilot. (LP: #1218636)

  [ Andy Doan ]
  * Add support for click packages. (LP: #1212833)

  [ Christopher Lee ]
  * commit message. (LP: #1205949)

  [ Martin Pitt ]
  * Add bamfdaemon to autopilot-desktop dependencies, to avoid long
    delays when running autopilot in minimal environments. (LP:
    #1224970)

  [ Ubuntu daily release ]
  * Automatic snapshot from revision 333
 -- Ubuntu daily release <email address hidden> Wed, 18 Sep 2013 06:03:34 +0000

Changed in autopilot (Ubuntu):
status: New → Fix Released
Changed in autopilot:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.