Tests failed with locked collection

Bug #1243622 reported by Christopher Meng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SecretStorage
Fix Released
Undecided
Unassigned

Bug Description

Hi,

I 'm packaging this software for Fedora at: https://bugzilla.redhat.com/show_bug.cgi?id=1021733

Now I met problem when testing it:

---------------------------

Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.NGiSNR
+ umask 022
+ cd /home/rpmaker/rpmbuild/BUILD
+ cd SecretStorage-1.0.0
+ pushd tests
~/rpmbuild/BUILD/SecretStorage-1.0.0/tests ~/rpmbuild/BUILD/SecretStorage-1.0.0
+ PYTHONPATH=/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages
+ nosetests-2.7
..EEEE..E
======================================================================
ERROR: test_create_empty_item (test_collection.CollectionTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rpmaker/rpmbuild/BUILD/SecretStorage-1.0.0/tests/test_collection.py", line 28, in test_create_empty_item
    item = self.collection.create_item('', {}, b'')
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/collection.py", line 120, in create_item
    self.ensure_not_locked()
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/collection.py", line 55, in ensure_not_locked
    raise LockedException('Collection is locked!')
LockedException: Collection is locked!

======================================================================
ERROR: test_label (test_collection.CollectionTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rpmaker/rpmbuild/BUILD/SecretStorage-1.0.0/tests/test_collection.py", line 33, in test_label
    self.collection.set_label('Hello!')
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/collection.py", line 109, in set_label
    self.ensure_not_locked()
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/collection.py", line 55, in ensure_not_locked
    raise LockedException('Collection is locked!')
LockedException: Collection is locked!

======================================================================
ERROR: test suite for <class 'test_compat_functions.CompatFunctionsTest'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/usr/lib/python2.7/site-packages/nose/util.py", line 469, in try_run
    return func()
  File "/home/rpmaker/rpmbuild/BUILD/SecretStorage-1.0.0/tests/test_compat_functions.py", line 23, in setUpClass
    ATTRIBUTES, PASSWORD)
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/__init__.py", line 96, in create_item
    collection.unlock()
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/collection.py", line 70, in unlock
    return exec_prompt_glib(self.bus, prompt)[0]
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/util.py", line 85, in exec_prompt_glib
    exec_prompt(bus, prompt, callback)
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/util.py", line 73, in exec_prompt
    prompt_iface.connect_to_signal('Completed', new_callback)
  File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 544, in connect_to_signal
    dbus_interface, **keywords)
  File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 369, in connect_to_signal
    **keywords)
  File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 148, in add_signal_receiver
    path, **keywords)
  File "/usr/lib/python2.7/site-packages/dbus/connection.py", line 400, in add_signal_receiver
    self._require_main_loop()
RuntimeError: To make asynchronous calls, receive signals or export objects, D-Bus connections must be attached to a main loop by passing mainloop=... to the constructor or calling dbus.set_default_main_loop(...)

======================================================================
ERROR: test_double_deleting (test_exceptions.ExceptionsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rpmaker/rpmbuild/BUILD/SecretStorage-1.0.0/tests/test_exceptions.py", line 22, in test_double_deleting
    {'application': 'secretstorage-test'}, b'pa$$word')
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/collection.py", line 120, in create_item
    self.ensure_not_locked()
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/collection.py", line 55, in ensure_not_locked
    raise LockedException('Collection is locked!')
LockedException: Collection is locked!

======================================================================
ERROR: test suite for <class 'test_item.ItemTest'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/usr/lib/python2.7/site-packages/nose/util.py", line 469, in try_run
    return func()
  File "/home/rpmaker/rpmbuild/BUILD/SecretStorage-1.0.0/tests/test_item.py", line 24, in setUpClass
    b'pa$$word')
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/collection.py", line 120, in create_item
    self.ensure_not_locked()
  File "/home/rpmaker/rpmbuild/BUILDROOT/python-SecretStorage-1.0.0-1.fc21.i386/usr/lib/python2.7/site-packages/secretstorage/collection.py", line 55, in ensure_not_locked
    raise LockedException('Collection is locked!')
LockedException: Collection is locked!

----------------------------------------------------------------------
Ran 7 tests in 0.893s

FAILED (errors=5)
error: Bad exit status from /var/tmp/rpm-tmp.NGiSNR (%check)

----------------------------------------------------------------------

Also my computer's keyring unlock window bumped out and asked my password. Since root user is not allowed to build RPM, I need your help now.

Thanks.

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Thanks for packaging it for Fedora!

The current trunk in lp:secretstorage (I'm going to release 1.1 in the next couple of weeks) contains a secretservice_mock.py file which allows you to export USE_SS_MOCK=1 and then the tests will pass even if there is no SecretService daemon running.

However, when you want to test it against a real-life implementation (i.e. GNOME Keyring), you should make sure it is running and the keyring is unlocked.

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Sorry, I meant lp:python-secretstorage.

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Unfortunately that code won't go into mainline branch of secretstorage, but you can grab it from lp:~mitya57/python-secretstorage/secretstorage-ng and use the test runner from there.

I'm going to rewrite the test suite to use the (real) Secret Service daemon written in C++.

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

With the latest code (I moved to Git, but Launchpad mirror still exists) you can run the tests in a *clean* environment using these steps:

- install gnome-keyring;
- export XDG_RUNTIME_DIR to some temporary directory;
- run "xvfb-run python3 -m unittest discover -s tests".

Note that this will leave running gnome-keyring-daemon, so you may need to kill it manually until https://bugzilla.gnome.org/show_bug.cgi?id=708765 is fixed.

Changed in python-secretstorage:
status: New → 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.