Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.27.4 causes gnome-bluetooth 42 tests to fail #123

Closed
smcv opened this issue Apr 4, 2022 · 2 comments · Fixed by #124
Closed

0.27.4 causes gnome-bluetooth 42 tests to fail #123

smcv opened this issue Apr 4, 2022 · 2 comments · Fixed by #124

Comments

@smcv
Copy link
Contributor

smcv commented Apr 4, 2022

gnome-bluetooth version 42 (Debian source package gnome-bluetooth3) passes its unit tests with python3-dbusmock 0.27.3-1 but fails with 0.27.4-1. This appears to have been caused by the more thorough D-Bus signature checking introduced to fix #118.

17/17 Tests.test_pairing                 FAIL            5.91s   exit status 1
17:32:44 top_srcdir=/<<PKGBUILDDIR>> top_builddir=/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu MALLOC_PERTURB_=88 /usr/bin/python3 /<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/../tests/integration-test.py Tests.test_pairing
----------------------------------- output -----------------------------------
stdout:
1649093564.622 AddAdapter "hci0" "my-computer"
1649093564.623 emit / org.freedesktop.DBus.ObjectManager.InterfacesAdded "/org/bluez/hci0" {"org.bluez.Adapter1": {"UUIDs": ["00001200-0000-1000-8000-00805f9b34fb", "00001800-0000-1000-8000-00805f9b34fb", "00001801-0000-1000-8000-00805f9b34fb", "0000110e-0000-1000-8000-00805f9b34fb", "0000110c-0000-1000-8000-00805f9b34fb"], "Discoverable": False, "Discovering": False, "Pairable": True, "Powered": True, "Address": "00:01:02:03:04:05", "AddressType": "public", "Alias": "my-computer", "Modalias": "usb:v1D6Bp0245d050A", "Name": "my-computer", "Class": 268, "DiscoverableTimeout": 180, "PairableTimeout": 0}}
1649093564.624 AddDevice "hci0" "11:22:33:44:55:66" "My Phone"
1649093564.624 emit / org.freedesktop.DBus.ObjectManager.InterfacesAdded "/org/bluez/hci0/dev_11_22_33_44_55_66" {"org.bluez.Device1": {"Address": "11:22:33:44:55:66", "AddressType": "public", "Name": "My Phone", "Icon": "", "Class": 0, "Appearance": 0, "UUIDs": [], "Paired": False, "Connected": False, "Trusted": False, "Blocked": False, "WakeAllowed": False, "Alias": "My Phone", "Adapter": "/org/bluez/hci0", "LegacyPairing": False, "Modalias": "", "RSSI": -79, "TxPower": 0, "ManufacturerData": [], "ServiceData": [], "ServicesResolved": False, "AdvertisingFlags": [], "AdvertisingData": []}}
1649093564.792 GetAll /org/freedesktop/UPower org.freedesktop.UPower
1649093564.793 GetManagedObjects
1649093564.797 Pair
1649093564.797 EnumerateDevices
1649093564.797 Pair raised: org.freedesktop.DBus.Error.InvalidArgs: Invalid arguments: More items found in D-Bus signature than in Python arguments
Running out-of-process test test_pairing
stderr:
F
======================================================================
FAIL: test_pairing (__main__.Tests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/../tests/integration-test.py", line 561, in test_pairing
    self.run_test_process()
  File "/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/../tests/integration-test.py", line 510, in run_test_process
    self.assertEqual(out.returncode, 0, "Running test " + test_name + " failed:" + out.stderr.decode('UTF-8') + '\n\n\nSTDOUT:\n' + out.stdout.decode('UTF-8'))
AssertionError: 1 != 0 : Running test test_pairing failed:Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/../tests/integration-test.py", line 290, in _pair_cb
    success, path = client.setup_device_finish(result)
gi.repository.GLib.GError: g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Invalid arguments: More items found in D-Bus signature than in Python arguments (16)
F
======================================================================
FAIL: test_pairing (__main__.OopTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/obj-x86_64-linux-gnu/../tests/integration-test.py", line 312, in test_pairing
    self.assertEqual(self.paired, True)
AssertionError: False != True

Merge request to follow.

smcv added a commit to smcv/python-dbusmock that referenced this issue Apr 4, 2022
With the more thorough signature checking from martinpitt#118, the gnome-bluetooth
unit tests fail, because Pair() called PairDevice() with 2 arguments
but PairDevice() expects 3 arguments. Optional arguments with a default
are not really something that exists in the interoperable subset of
D-Bus.

Signed-off-by: Simon McVittie <smcv@debian.org>
Resolves: martinpitt#123
@smcv
Copy link
Contributor Author

smcv commented Apr 4, 2022

(Bug also reported in Debian, bug number not yet received.)

@martinpitt
Copy link
Owner

martinpitt commented Apr 5, 2022

Eww, thanks for spotting! tests/test_bluez5.py even has a test_pairing_device, but it was disabled ages ago because it's flaky. But it does spot that regression.

There is one other instance of a default argument in a D-Bus service method, in the AccountsService template. I'll get that fixed as well.

martinpitt pushed a commit that referenced this issue Apr 5, 2022
…ent (#124)

With the more thorough signature checking from #118, the gnome-bluetooth
unit tests fail, because Pair() called PairDevice() with 2 arguments
but PairDevice() expects 3 arguments. Optional arguments with a default
are not really something that exists in the interoperable subset of
D-Bus.

Fixes part of #123
https://bugs.debian.org/1008941
martinpitt added a commit that referenced this issue Apr 5, 2022
D-Bus does not support default arguments, and we fixed our callers to
specify it explicitly. See #123
gnomesysadmins pushed a commit to GNOME/folks that referenced this issue Oct 11, 2022
Upstream python-dbusmock changed its API for `PairDevice()` to include a
class parameter. For Python code, this API break was solved by providing
a default value for the argument. Since we rely on the D-Bus interface
however and D-Bus doesn't have a concept of default arguments, this just
broke with an error:

> Error setting up mock BlueZ device:
> GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Invalid arguments:
> More items found in D-Bus signature than in Python arguments

Add the same default argument in our Vala interface to work around the
problem.

Related links:
* martinpitt/python-dbusmock#45
* martinpitt/python-dbusmock#123
gnomesysadmins pushed a commit to GNOME/folks that referenced this issue Oct 11, 2022
Upstream python-dbusmock changed its API for `PairDevice()` to include a
class parameter. For Python code, this API break was solved by providing
a default value for the argument. Since we rely on the D-Bus interface
however and D-Bus doesn't have a concept of default arguments, this just
broke with an error:

> Error setting up mock BlueZ device:
> GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Invalid arguments:
> More items found in D-Bus signature than in Python arguments

Add the same default argument in our Vala interface to work around the
problem.

Related links:
* martinpitt/python-dbusmock#45
* martinpitt/python-dbusmock#123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants