test_updates_interval fails on focal

Bug #1852772 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
Fix Released
High
Corey Bryant

Bug Description

======================================================================
FAIL: test_updates_interval (tests.test_dbus.TestDBus)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/build/software-properties-0.98.6/tests/test_dbus.py", line 332, in test_updates_interval
    self.assertTrue('APT::Periodic::Update-Package-Lists "1";' in config)
AssertionError: False is not true

Looking closer, while in the SetUpdateInterval() method in softwareproperties/dbus/SoftwarePropertiesDBus.py, days is of dbus.Int32 type. A simple print output shows:

days=dbus.Int32(1)

D-Bus is statically typed, unlike python. More details at:
https://dbus.freedesktop.org/doc/dbus-python/tutorial.html#data-types

I think once we're in the dbus method (SetUpdateInterval() method in softwareproperties/dbus/SoftwarePropertiesDBus.py) we can convert the dbus.Int32 to an int.

Changed in software-properties (Ubuntu):
status: New → Triaged
importance: Undecided → High
tags: added: rls-ff-incoming
Revision history for this message
Corey Bryant (corey.bryant) wrote :

I should have mentioned that I have a fix for this just running it by mvo.

Revision history for this message
Corey Bryant (corey.bryant) wrote :

My proposed fix for this is:

diff --git a/softwareproperties/dbus/SoftwarePropertiesDBus.py b/softwareproperties/dbus/SoftwarePropertiesDBus.py
index c22f43b..7683a1a 100644
--- a/softwareproperties/dbus/SoftwarePropertiesDBus.py
+++ b/softwareproperties/dbus/SoftwarePropertiesDBus.py
@@ -266,7 +266,7 @@ class SoftwarePropertiesDBus(dbus.service.Object, SoftwareProperties):
     def SetUpdateInterval(self, days, sender=None, conn=None):
         self._check_policykit_privilege(
             sender, conn, "com.ubuntu.softwareproperties.applychanges")
- self.set_update_interval(days)
+ self.set_update_interval(int(days))

I'd like to get a +1 before uploading that though.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

I see no objection at all; that fix looks obviously correct and does fix the test.

Changed in software-properties (Ubuntu):
assignee: nobody → Corey Bryant (corey.bryant)
Revision history for this message
Corey Bryant (corey.bryant) wrote :
tags: added: rls-ff-notfixing
removed: rls-ff-incoming
Changed in software-properties (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-properties - 0.98.6

---------------
software-properties (0.98.6) focal; urgency=medium

  * cloudarchive: Enable support for the Ussuri Ubuntu Cloud Archive on
    18.04 (LP: #1852489).
  * softwareproperties/dbus/SoftwarePropertiesDBus.py: In SetUpdateInterval,
    convert days argument from dbus.Int32 to int before passing to
    set_update_interval. This fixes a test failures as apt_pkg.config.set
    didn't understand a dbus.Int32 type (LP: #1852772).
  * debian/control: Add gpg and gpg-agent to Build-Depends to fix failing
    unit tests (LP: #1852773).

 -- Corey Bryant <email address hidden> Wed, 13 Nov 2019 16:00:59 -0500

Changed in software-properties (Ubuntu):
status: Fix Committed → Fix Released
tags: added: id-5ddff3a8c61a0a7a58a83a70
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.