Merge lp://qastaging/~cmiller/desktopcouch/defer-dbus-until-after-plugins into lp://qastaging/desktopcouch

Proposed by Chad Miller
Status: Merged
Approved by: Chad Miller
Approved revision: 281
Merged at revision: 274
Proposed branch: lp://qastaging/~cmiller/desktopcouch/defer-dbus-until-after-plugins
Merge into: lp://qastaging/desktopcouch
Diff against target: 718 lines (+243/-135)
10 files modified
desktopcouch/application/local_files.py (+3/-1)
desktopcouch/application/platform/windows/tests/test_base_dirs.py (+2/-2)
desktopcouch/application/plugins/__init__.py (+13/-3)
desktopcouch/application/plugins/tests/test_plugins.py (+3/-1)
desktopcouch/application/plugins/tests/test_ubuntuone_pairing.py (+33/-8)
desktopcouch/application/plugins/ubuntuone_pairing.py (+62/-43)
desktopcouch/application/service.py (+27/-4)
desktopcouch/application/tests/test_service.py (+88/-62)
desktopcouch/records/tests/test_mocked_server.py (+4/-3)
desktopcouch/recordtypes/contacts/tests/test_view.py (+8/-8)
To merge this branch: bzr merge lp://qastaging/~cmiller/desktopcouch/defer-dbus-until-after-plugins
Reviewer Review Type Date Requested Status
dobey (community) Approve
Natalia Bidart (community) Approve
Review via email: mp+57589@code.qastaging.launchpad.net

Commit message

Add ability for plugins to delay DBus service activation until they are finished processing. Make ubuntuone_pairing plugin use this. (LP: #760236)

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Can you please make the docstring of load_plugins pep-257 compliant?

Also, I don't understand why you're passing gobject around, is that really needed?

review: Needs Fixing
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Also, a test run failed with:

===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/case.py", line 321, in run
    testMethod()
  File "/home/nessita/canonical/desktopcouch/review_defer-dbus-until-after-plugins/desktopcouch/recordtypes/contacts/tests/test_view.py", line 287, in test_find_contact_starting
    self.assertEqual(len(contacts), 1)
  File "/usr/lib/python2.7/unittest/case.py", line 503, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib/python2.7/unittest/case.py", line 496, in _baseAssertEqual
    raise self.failureException(msg)
exceptions.AssertionError: 2 != 1

desktopcouch.recordtypes.contacts.tests.test_view.TestLocalFiles.test_find_contact_starting

review: Needs Fixing
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

I can't reproduce the test failure in trunk, so it seems like something in this branch is generating that failure?

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Chad,

I re ran the test suite several times and the test case will not fail anymore, looks like a transient error (that should be debugged but I don't want to delay your branch anymore).

I'm approving so you can move on, but please fix all the (new) "Reimport" errors from pylint before landing.

Thanks!

review: Approve
Revision history for this message
Chad Miller (cmiller) wrote :

I've run this test in a loop more than 1200 times, and can't reproduce it. We've seen something like it on trunk before, though.

Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Chad Miller (cmiller) wrote :
Download full text (16.4 KiB)

The attempt to merge lp:~cmiller/desktopcouch/defer-dbus-until-after-plugins into lp:desktopcouch failed. Below is the output from the failed tests.

Apache CouchDB has started, time to relax.
Browse your desktop CouchDB at file:///tmp/tmp_DEgO4/data/couchdb.html
desktopcouch.application.migration.tests.test_migration
  TestMigration
    test_migration_deleted_flag_to_trash ... [OK]
    test_migration_in_face_of_broken_records ... [OK]
    test_migration_script_is_run ... [OK]
    test_migration_script_is_run_and_can_access_view ... [OK]
  TestRegistration
    test_register_migration_is_added_to_the_registry ... [OK]
desktopcouch.application.pair.tests.test_couchdb_io
  TestCouchdbIo
    test_get_database_names_replicatable ... [OK]
    test_get_my_host_unique_id ... [OK]
    test_mkuri ... [OK]
    test_obsfuscation ... [OK]
    test_put_dynamic_paired_host ... [OK]
    test_put_static_paired_service ... [OK]
desktopcouch.application.pair.tests.test_network_io
  TestNetworkIO
    test_successful_lifespan ... [OK]
desktopcouch.application.platform.linux.tests.test_keyring
  TestGnomeKeyring
    test_get_aouth_no_keyring ... [OK]
    test_get_oauth_canceled_store ... [OK]
    test_get_oauth_data_stored ... [OK]
    test_get_user_name_password_keyring ... [OK]
    test_get_user_name_password_no_daemon ... [OK]
    test_get_user_name_password_not_in_keyring ... [OK]
    test_get_user_name_password_user_cancel ... [OK]
desktopcouch.application.platform.windows.tests.test_base_dirs
  BaseDirsTestCase
    test_get_special_folders ... [OK]
    test_get_special_folders_cannot_get_data ... [OK]
    test_get_special_folders_cannot_open_hive ... [OK]
    test_get_special_folders_cannot_open_key ... [OK]
desktopcouch.application.platform.windows.tests.test_keyring
  TestKeyring
    test_get_oauth_data ... [OK]
    test_get_user_name_password ... [OK]
    test_get_user_name_password_no_key ... [OK]
    test_get_user_name_password_no_value ... [OK]
desktopcouch.application.plugins.tests.test_plugins
  TestLoadPlugins
    test_load_plugins ... [OK]
desktopcouch.application.plugins.tests.test_ubuntuone_pairing
  TestUbuntonePairing
    test_pair_with_ubuntuone_no_record ... [OK]
...

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (28.6 KiB)

The attempt to merge lp:~cmiller/desktopcouch/defer-dbus-until-after-plugins into lp:desktopcouch failed. Below is the output from the failed tests.

Apache CouchDB has started, time to relax.
Browse your desktop CouchDB at file:///tmp/tmpJCnr4N/data/couchdb.html
desktopcouch.application.migration.tests.test_migration
  TestMigration
    test_migration_deleted_flag_to_trash ... [OK]
    test_migration_in_face_of_broken_records ... [OK]
    test_migration_script_is_run ... [OK]
    test_migration_script_is_run_and_can_access_view ... [OK]
  TestRegistration
    test_register_migration_is_added_to_the_registry ... [OK]
desktopcouch.application.plugins.tests.test_ubuntuone_pairing
  TestUbuntonePairing
    test_pair_with_ubuntuone_no_record ... [OK]
    test_pair_with_ubuntuone_no_view ... [OK]
    test_pair_with_ubuntuone_record_present ... [OK]
    test_pair_with_ubuntuone_user_deleted_record ... [OK]
  TestUbuntuOnePlugin
    test_got_new_credentials ... [OK]
    test_got_new_credentials_other ... [OK]
    test_listen_to_dbus ... [OK]
desktopcouch.application.plugins.tests.test_plugins
  TestLoadPlugins
    test_load_plugins ... [OK]
desktopcouch.application.pair.tests.test_network_io
  TestNetworkIO
    test_successful_lifespan ... [OK]
desktopcouch.application.pair.tests.test_couchdb_io
  TestCouchdbIo
    test_get_database_names_replicatable ... [OK]
    test_get_my_host_unique_id ... [OK]
    test_mkuri ... [OK]
    test_obsfuscation ... [OK]
    test_put_dynamic_paired_host ... [OK]
    test_put_static_paired_service ... [OK]
desktopcouch.application.tests.test_service
  TestService
    test_start_desktopcouch_replication ... [OK]
    test_start_migrate_data ... [OK]
    test_start_new_desktopcouch_with_plugins ... Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/case.py", line 321, in run
    testMethod()
  File "/usr/lib/pymodules/python2.7/mocker.py", line 146, in test_method_wrapper
    result = test_method()
  File "/home/otto/tarmac-builds/desktopcouch/trunk/desktopcouch/application/tests/test_service.py", line 135, in test_start_new_desktopcouch_with_plugins
    put_service_fn=put_service_fn)
exceptions.TypeError: fail_if_called() takes at most 1 argument (4 given)
[ERROR]
desktopcouch.application.tests.test_local_files
  TestKeyringIntegration
    test_with_auth ... [OK]
    test_with_no_...

Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (26.9 KiB)

The attempt to merge lp:~cmiller/desktopcouch/defer-dbus-until-after-plugins into lp:desktopcouch failed. Below is the output from the failed tests.

Apache CouchDB has started, time to relax.
Browse your desktop CouchDB at file:///tmp/tmpHzJDQ2/data/couchdb.html
desktopcouch.application.migration.tests.test_migration
  TestMigration
    test_migration_deleted_flag_to_trash ... [OK]
    test_migration_in_face_of_broken_records ... [OK]
    test_migration_script_is_run ... [OK]
    test_migration_script_is_run_and_can_access_view ... [OK]
  TestRegistration
    test_register_migration_is_added_to_the_registry ... [OK]
desktopcouch.application.plugins.tests.test_ubuntuone_pairing
  TestUbuntonePairing
    test_pair_with_ubuntuone_no_record ... [OK]
    test_pair_with_ubuntuone_no_view ... [OK]
    test_pair_with_ubuntuone_record_present ... [OK]
    test_pair_with_ubuntuone_user_deleted_record ... [OK]
  TestUbuntuOnePlugin
    test_got_new_credentials ... [OK]
    test_got_new_credentials_other ... [OK]
    test_listen_to_dbus ... [OK]
desktopcouch.application.plugins.tests.test_plugins
  TestLoadPlugins
    test_load_plugins ... [OK]
desktopcouch.application.pair.tests.test_network_io
  TestNetworkIO
    test_successful_lifespan ... [OK]
desktopcouch.application.pair.tests.test_couchdb_io
  TestCouchdbIo
    test_get_database_names_replicatable ... [OK]
    test_get_my_host_unique_id ... [OK]
    test_mkuri ... [OK]
    test_obsfuscation ... [OK]
    test_put_dynamic_paired_host ... [OK]
    test_put_static_paired_service ... [OK]
desktopcouch.application.tests.test_service
  TestService
    test_start_desktopcouch_replication ... [OK]
    test_start_migrate_data ... [OK]
    test_start_new_desktopcouch_with_plugins ... Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/case.py", line 321, in run
    testMethod()
  File "/usr/lib/pymodules/python2.7/mocker.py", line 146, in test_method_wrapper
    result = test_method()
  File "/home/otto/tarmac-builds/desktopcouch/trunk/desktopcouch/application/tests/test_service.py", line 135, in test_start_new_desktopcouch_with_plugins
    put_service_fn=put_service_fn)
exceptions.TypeError: fail_if_called() takes at most 1 argument (4 given)
[ERROR]
desktopcouch.application.tests.test_local_files
  TestKeyringIntegration
    test_with_auth ... [OK]
    test_with_no_...

Revision history for this message
dobey (dobey) wrote :

Something very weird is going on in the tests here. This change seems to fix it here:

=== modified file 'desktopcouch/application/plugins/tests/test_ubuntuone_pairing.py'
--- desktopcouch/application/plugins/tests/test_ubuntuone_pairing.py 2011-04-13 21:31:15 +0000
+++ desktopcouch/application/plugins/tests/test_ubuntuone_pairing.py 2011-04-15 01:56:27 +0000
@@ -136,11 +136,13 @@ class TestUbuntuOnePlugin(MockerTestCase
             """Fail if we get called."""
             self.called = True

+ old_pair = uone.pair_with_ubuntuone
         uone.pair_with_ubuntuone = fail_if_called
         uone.got_new_credentials(self.couchdb_port, self.blocking_semaphores,
                                  'Unknown App', {})
         self.assertFalse(self.called, 'pair_with_ubuntuone was not expected.')
         self.mocker.replay()
+ uone.pair_with_ubuntuone = old_pair

     def test_got_new_credentials(self):
         """Check that pairing is called for Ubuntu One."""
@@ -148,11 +150,13 @@ class TestUbuntuOnePlugin(MockerTestCase
             """Check that pair_with_ubuntuone was called."""
             self.called = True

+ old_pair = uone.pair_with_ubuntuone
         uone.pair_with_ubuntuone = pass_if_called
         uone.got_new_credentials(self.couchdb_port, self.blocking_semaphores,
                                  uone.APP_NAME, {})
         self.assertTrue(self.called, 'pair_with_ubuntuone was not called.')
         self.mocker.replay()
+ uone.pair_with_ubuntuone = old_pair

     def test_listen_to_dbus(self):
         """Test that listening to credentails works."""

281. By Chad Miller

Save and restore the monkey-patched pair_with_ubuntuone function. I have no idea how this was working, but tests fail elsewhere.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches