python-dbusmock 0.33.0__tar.gz → 0.34.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. python_dbusmock-0.34.0/.github/release.eloquent.yml +2 -0
  2. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/.github/workflows/release.yml +6 -7
  3. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/.github/workflows/tests.yml +1 -1
  4. {python-dbusmock-0.33.0/python_dbusmock.egg-info → python_dbusmock-0.34.0}/PKG-INFO +172 -7
  5. python_dbusmock-0.34.0/dbusmock/_version.py +1 -0
  6. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/bluez5.py +3 -3
  7. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/modemmanager.py +84 -10
  8. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/upower.py +1 -1
  9. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/packit.yaml +6 -7
  10. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0/python_dbusmock.egg-info}/PKG-INFO +172 -7
  11. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/run-debian +0 -7
  12. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/run-ubuntu +0 -7
  13. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_modemmanager.py +16 -0
  14. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_networkmanager.py +1 -1
  15. python-dbusmock-0.33.0/.github/release.eloquent.yml +0 -2
  16. python-dbusmock-0.33.0/dbusmock/_version.py +0 -1
  17. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/.fmf/version +0 -0
  18. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/.github/workflows/pages.yml +0 -0
  19. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/.gitignore +0 -0
  20. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/.pre-commit-config.yaml +0 -0
  21. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/COPYING +0 -0
  22. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/NEWS +0 -0
  23. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/README.md +0 -0
  24. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/__init__.py +0 -0
  25. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/__main__.py +0 -0
  26. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/mockobject.py +0 -0
  27. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/pytest_fixtures.py +0 -0
  28. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/SKELETON +0 -0
  29. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/__init__.py +0 -0
  30. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/bluez5-obex.py +0 -0
  31. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/gnome_screensaver.py +0 -0
  32. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/gsd_rfkill.py +0 -0
  33. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/iio-sensors-proxy.py +0 -0
  34. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/logind.py +0 -0
  35. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/low_memory_monitor.py +0 -0
  36. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/networkmanager.py +0 -0
  37. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/notification_daemon.py +0 -0
  38. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/ofono.py +0 -0
  39. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/polkitd.py +0 -0
  40. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/power_profiles_daemon.py +0 -0
  41. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/systemd.py +0 -0
  42. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/timedated.py +0 -0
  43. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/upower_power_profiles_daemon.py +0 -0
  44. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/templates/urfkill.py +0 -0
  45. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/dbusmock/testcase.py +0 -0
  46. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/doc/conf.py +0 -0
  47. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/doc/index.rst +0 -0
  48. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/packaging/python-dbusmock.spec +0 -0
  49. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/plans/all.fmf +0 -0
  50. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/pyproject.toml +0 -0
  51. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/python_dbusmock.egg-info/SOURCES.txt +0 -0
  52. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/python_dbusmock.egg-info/dependency_links.txt +0 -0
  53. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/python_dbusmock.egg-info/requires.txt +0 -0
  54. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/python_dbusmock.egg-info/top_level.txt +0 -0
  55. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/setup.cfg +0 -0
  56. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/setup.py +0 -0
  57. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/__init__.py +0 -0
  58. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/conftest.py +0 -0
  59. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/main.fmf +0 -0
  60. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/run +0 -0
  61. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/run-centos +0 -0
  62. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/run-fedora +0 -0
  63. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_api.py +0 -0
  64. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_api_pytest.py +0 -0
  65. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_bluez5.py +0 -0
  66. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_cli.py +0 -0
  67. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_code.py +0 -0
  68. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_gnome_screensaver.py +0 -0
  69. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_gsd_rfkill.py +0 -0
  70. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_iio_sensors_proxy.py +0 -0
  71. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_logind.py +0 -0
  72. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_low_memory_monitor.py +0 -0
  73. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_notification_daemon.py +0 -0
  74. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_ofono.py +0 -0
  75. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_polkitd.py +0 -0
  76. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_power_profiles_daemon.py +0 -0
  77. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_systemd.py +0 -0
  78. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_timedated.py +0 -0
  79. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_upower.py +0 -0
  80. {python-dbusmock-0.33.0 → python_dbusmock-0.34.0}/tests/test_urfkill.py +0 -0
@@ -0,0 +1,2 @@
1
+ assets:
2
+ - path: dist/python_dbusmock*.tar.*
@@ -6,7 +6,7 @@ on:
6
6
  - '[0-9]*'
7
7
  jobs:
8
8
  release:
9
- runs-on: ubuntu-22.04
9
+ runs-on: ubuntu-24.04
10
10
  environment: release
11
11
  permissions:
12
12
  # PyPI trusted publisher
@@ -26,19 +26,18 @@ jobs:
26
26
  - name: Install dependencies
27
27
  run: |
28
28
  sudo apt-get update
29
- sudo apt-get install -y python3-setuptools python3-setuptools-scm python3-dbus
30
- dpkg -l
29
+ sudo apt-get install -y python3-build python3-setuptools python3-setuptools-scm python3-venv
31
30
 
32
31
  - name: Build release tarball
33
- run: ./setup.py sdist
32
+ run: python3 -m build --sdist
34
33
 
35
34
  - name: Sanity check
36
35
  run: |
37
36
  set -eux
38
37
  mkdir tmp
39
38
  cd tmp
40
- tar xf ../dist/python-dbusmock-${{ github.ref_name }}.tar.gz
41
- cd python-dbusmock-*
39
+ tar xf ../dist/python_dbusmock-${{ github.ref_name }}.tar.gz
40
+ cd python_dbusmock-*
42
41
  test "$(PYTHONPATH=. python3 -c 'import dbusmock; print(dbusmock.__version__)')" = "${{ github.ref_name }}"
43
42
  PYTHONPATH=. python3 tests/test_api.py
44
43
  cd ../..
@@ -47,7 +46,7 @@ jobs:
47
46
  - name: Create GitHub release
48
47
  uses: cockpit-project/action-release@7d2e2657382e8d34f88a24b5987f2b81ea165785
49
48
  with:
50
- filename: "dist/python-dbusmock-${{ github.ref_name }}.tar.gz"
49
+ filename: "dist/python_dbusmock-${{ github.ref_name }}.tar.gz"
51
50
 
52
51
  - name: Create PyPy release
53
52
  uses: pypa/gh-action-pypi-publish@release/v1
@@ -6,7 +6,7 @@ on:
6
6
  - cron: 0 4 * * MON,FRI
7
7
  jobs:
8
8
  OS:
9
- runs-on: ubuntu-latest
9
+ runs-on: ubuntu-24.04
10
10
  strategy:
11
11
  fail-fast: false
12
12
  matrix:
@@ -1,13 +1,178 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-dbusmock
3
- Version: 0.33.0
3
+ Version: 0.34.0
4
4
  Summary: Mock D-Bus objects
5
5
  Home-page: https://github.com/martinpitt/python-dbusmock
6
- Author: Martin Pitt
7
- Author-email: martin@piware.de
8
- License: LGPL 3+
9
6
  Download-URL: https://pypi.python.org/pypi/python-dbusmock/
10
- Platform: UNKNOWN
7
+ Author: Martin Pitt
8
+ Author-email: Martin Pitt <martin@piware.de>
9
+ License: GNU LESSER GENERAL PUBLIC LICENSE
10
+ Version 3, 29 June 2007
11
+
12
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
13
+ Everyone is permitted to copy and distribute verbatim copies
14
+ of this license document, but changing it is not allowed.
15
+
16
+
17
+ This version of the GNU Lesser General Public License incorporates
18
+ the terms and conditions of version 3 of the GNU General Public
19
+ License, supplemented by the additional permissions listed below.
20
+
21
+ 0. Additional Definitions.
22
+
23
+ As used herein, "this License" refers to version 3 of the GNU Lesser
24
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
25
+ General Public License.
26
+
27
+ "The Library" refers to a covered work governed by this License,
28
+ other than an Application or a Combined Work as defined below.
29
+
30
+ An "Application" is any work that makes use of an interface provided
31
+ by the Library, but which is not otherwise based on the Library.
32
+ Defining a subclass of a class defined by the Library is deemed a mode
33
+ of using an interface provided by the Library.
34
+
35
+ A "Combined Work" is a work produced by combining or linking an
36
+ Application with the Library. The particular version of the Library
37
+ with which the Combined Work was made is also called the "Linked
38
+ Version".
39
+
40
+ The "Minimal Corresponding Source" for a Combined Work means the
41
+ Corresponding Source for the Combined Work, excluding any source code
42
+ for portions of the Combined Work that, considered in isolation, are
43
+ based on the Application, and not on the Linked Version.
44
+
45
+ The "Corresponding Application Code" for a Combined Work means the
46
+ object code and/or source code for the Application, including any data
47
+ and utility programs needed for reproducing the Combined Work from the
48
+ Application, but excluding the System Libraries of the Combined Work.
49
+
50
+ 1. Exception to Section 3 of the GNU GPL.
51
+
52
+ You may convey a covered work under sections 3 and 4 of this License
53
+ without being bound by section 3 of the GNU GPL.
54
+
55
+ 2. Conveying Modified Versions.
56
+
57
+ If you modify a copy of the Library, and, in your modifications, a
58
+ facility refers to a function or data to be supplied by an Application
59
+ that uses the facility (other than as an argument passed when the
60
+ facility is invoked), then you may convey a copy of the modified
61
+ version:
62
+
63
+ a) under this License, provided that you make a good faith effort to
64
+ ensure that, in the event an Application does not supply the
65
+ function or data, the facility still operates, and performs
66
+ whatever part of its purpose remains meaningful, or
67
+
68
+ b) under the GNU GPL, with none of the additional permissions of
69
+ this License applicable to that copy.
70
+
71
+ 3. Object Code Incorporating Material from Library Header Files.
72
+
73
+ The object code form of an Application may incorporate material from
74
+ a header file that is part of the Library. You may convey such object
75
+ code under terms of your choice, provided that, if the incorporated
76
+ material is not limited to numerical parameters, data structure
77
+ layouts and accessors, or small macros, inline functions and templates
78
+ (ten or fewer lines in length), you do both of the following:
79
+
80
+ a) Give prominent notice with each copy of the object code that the
81
+ Library is used in it and that the Library and its use are
82
+ covered by this License.
83
+
84
+ b) Accompany the object code with a copy of the GNU GPL and this license
85
+ document.
86
+
87
+ 4. Combined Works.
88
+
89
+ You may convey a Combined Work under terms of your choice that,
90
+ taken together, effectively do not restrict modification of the
91
+ portions of the Library contained in the Combined Work and reverse
92
+ engineering for debugging such modifications, if you also do each of
93
+ the following:
94
+
95
+ a) Give prominent notice with each copy of the Combined Work that
96
+ the Library is used in it and that the Library and its use are
97
+ covered by this License.
98
+
99
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
100
+ document.
101
+
102
+ c) For a Combined Work that displays copyright notices during
103
+ execution, include the copyright notice for the Library among
104
+ these notices, as well as a reference directing the user to the
105
+ copies of the GNU GPL and this license document.
106
+
107
+ d) Do one of the following:
108
+
109
+ 0) Convey the Minimal Corresponding Source under the terms of this
110
+ License, and the Corresponding Application Code in a form
111
+ suitable for, and under terms that permit, the user to
112
+ recombine or relink the Application with a modified version of
113
+ the Linked Version to produce a modified Combined Work, in the
114
+ manner specified by section 6 of the GNU GPL for conveying
115
+ Corresponding Source.
116
+
117
+ 1) Use a suitable shared library mechanism for linking with the
118
+ Library. A suitable mechanism is one that (a) uses at run time
119
+ a copy of the Library already present on the user's computer
120
+ system, and (b) will operate properly with a modified version
121
+ of the Library that is interface-compatible with the Linked
122
+ Version.
123
+
124
+ e) Provide Installation Information, but only if you would otherwise
125
+ be required to provide such information under section 6 of the
126
+ GNU GPL, and only to the extent that such information is
127
+ necessary to install and execute a modified version of the
128
+ Combined Work produced by recombining or relinking the
129
+ Application with a modified version of the Linked Version. (If
130
+ you use option 4d0, the Installation Information must accompany
131
+ the Minimal Corresponding Source and Corresponding Application
132
+ Code. If you use option 4d1, you must provide the Installation
133
+ Information in the manner specified by section 6 of the GNU GPL
134
+ for conveying Corresponding Source.)
135
+
136
+ 5. Combined Libraries.
137
+
138
+ You may place library facilities that are a work based on the
139
+ Library side by side in a single library together with other library
140
+ facilities that are not Applications and are not covered by this
141
+ License, and convey such a combined library under terms of your
142
+ choice, if you do both of the following:
143
+
144
+ a) Accompany the combined library with a copy of the same work based
145
+ on the Library, uncombined with any other library facilities,
146
+ conveyed under the terms of this License.
147
+
148
+ b) Give prominent notice with the combined library that part of it
149
+ is a work based on the Library, and explaining where to find the
150
+ accompanying uncombined form of the same work.
151
+
152
+ 6. Revised Versions of the GNU Lesser General Public License.
153
+
154
+ The Free Software Foundation may publish revised and/or new versions
155
+ of the GNU Lesser General Public License from time to time. Such new
156
+ versions will be similar in spirit to the present version, but may
157
+ differ in detail to address new problems or concerns.
158
+
159
+ Each version is given a distinguishing version number. If the
160
+ Library as you received it specifies that a certain numbered version
161
+ of the GNU Lesser General Public License "or any later version"
162
+ applies to it, you have the option of following the terms and
163
+ conditions either of that published version or of any later version
164
+ published by the Free Software Foundation. If the Library as you
165
+ received it does not specify a version number of the GNU Lesser
166
+ General Public License, you may choose any version of the GNU Lesser
167
+ General Public License ever published by the Free Software Foundation.
168
+
169
+ If the Library as you received it specifies that a proxy can decide
170
+ whether future versions of the GNU Lesser General Public License shall
171
+ apply, that proxy's public statement of acceptance of any version is
172
+ permanent authorization for you to choose that version for the
173
+ Library.
174
+
175
+ Project-URL: homepage, https://github.com/martinpitt/python-dbusmock
11
176
  Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
12
177
  Classifier: Programming Language :: Python :: 3
13
178
  Classifier: Development Status :: 6 - Mature
@@ -19,8 +184,10 @@ Classifier: Topic :: Software Development :: Testing
19
184
  Classifier: Topic :: Software Development :: Testing :: Mocking
20
185
  Classifier: Topic :: Software Development :: Testing :: Unit
21
186
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
187
+ Requires-Python: >=3.8
22
188
  Description-Content-Type: text/markdown
23
189
  License-File: COPYING
190
+ Requires-Dist: dbus-python
24
191
 
25
192
  ![CI status](https://github.com/martinpitt/python-dbusmock/actions/workflows/tests.yml/badge.svg)
26
193
 
@@ -422,5 +589,3 @@ re-run all tests in the container shell like above. You can also run a specific
422
589
  test:
423
590
 
424
591
  python3 -m unittest tests.test_api.TestAPI.test_onearg_ret
425
-
426
-
@@ -0,0 +1 @@
1
+ __version__ = "0.34.0"
@@ -95,7 +95,7 @@ def RequestDefaultAgent(manager, agent_path):
95
95
  manager.default_agent = agent_path
96
96
 
97
97
 
98
- def load(mock, _parameters):
98
+ def load(mock, parameters):
99
99
  mock.AddObject(
100
100
  "/org/bluez",
101
101
  AGENT_MANAGER_IFACE,
@@ -120,9 +120,9 @@ def load(mock, _parameters):
120
120
  bluez.default_agent = None
121
121
 
122
122
  # whether to expose the LEAdvertisingManager1 interface on adapters (BLE advertising)
123
- bluez.enable_advertise_api = _parameters.get("enable_advertise_api", True)
123
+ bluez.enable_advertise_api = parameters.get("enable_advertise_api", True)
124
124
  # whether to expose the AdvertisementMonitorManager1 interface on adapters (Passive scanning)
125
- bluez.enable_monitor_api = _parameters.get("enable_monitor_api", True)
125
+ bluez.enable_monitor_api = parameters.get("enable_monitor_api", True)
126
126
 
127
127
 
128
128
  @dbus.service.method(ADAPTER_IFACE, in_signature="o", out_signature="")
@@ -22,11 +22,14 @@ BUS_NAME = "org.freedesktop.ModemManager1"
22
22
  MAIN_OBJ = "/org/freedesktop/ModemManager1"
23
23
  MAIN_IFACE = "org.freedesktop.ModemManager1"
24
24
  SYSTEM_BUS = True
25
- IS_OBJECT_MANAGER = True
25
+ IS_OBJECT_MANAGER = False
26
26
  MODEM_IFACE = "org.freedesktop.ModemManager1.Modem"
27
27
  MODEM_3GPP_IFACE = "org.freedesktop.ModemManager1.Modem.Modem3gpp"
28
+ MODEM_CELL_BROADCAST_IFACE = "org.freedesktop.ModemManager1.Modem.CellBroadcast"
28
29
  MODEM_VOICE_IFACE = "org.freedesktop.ModemManager1.Modem.Voice"
29
30
  SIM_IFACE = "org.freedesktop.ModemManager1.Sim"
31
+ CBM_IFACE = "org.freedesktop.ModemManager1.Cbm"
32
+ SIMPLE_MODEM_PATH = "/org/freedesktop/ModemManager1/Modems/8"
30
33
 
31
34
 
32
35
  class MMModemMode:
@@ -118,6 +121,35 @@ def load(mock, parameters):
118
121
  mock.AddMethods(MAIN_IFACE, methods)
119
122
  mock.AddProperties(MAIN_IFACE, props)
120
123
 
124
+ cond = "k != '/'" if mock.path == "/" else f"k.startswith('{mock.path}/Modems/')"
125
+ code = f"ret = {{dbus.ObjectPath(k): objects[k].props for k in objects.keys() if {cond} }}"
126
+ mock.AddMethod(OBJECT_MANAGER_IFACE, "GetManagedObjects", "", "a{oa{sa{sv}}}", code)
127
+
128
+
129
+ def listCbm(_):
130
+ paths = []
131
+ for path in mockobject.objects:
132
+ if path.startswith("/org/freedesktop/ModemManager1/Cbm/"):
133
+ paths.append(dbus.ObjectPath(path))
134
+ return paths
135
+
136
+
137
+ def deleteCbm(self, cbm_path):
138
+ obj = mockobject.objects.get(cbm_path)
139
+ if obj is None:
140
+ return
141
+
142
+ modem_obj = mockobject.objects[SIMPLE_MODEM_PATH]
143
+ self.RemoveObject(cbm_path)
144
+ modem_obj.EmitSignal(
145
+ MODEM_CELL_BROADCAST_IFACE,
146
+ "Deleted",
147
+ "o",
148
+ [
149
+ cbm_path,
150
+ ],
151
+ )
152
+
121
153
 
122
154
  @dbus.service.method(MOCK_IFACE, in_signature="", out_signature="ss")
123
155
  def AddSimpleModem(self):
@@ -127,7 +159,7 @@ def AddSimpleModem(self):
127
159
 
128
160
  Returns the new object path.
129
161
  """
130
- modem_path = "/org/freedesktop/ModemManager1/Modems/8"
162
+ modem_path = SIMPLE_MODEM_PATH
131
163
  sim_path = "/org/freedesktop/ModemManager1/SIM/2"
132
164
  manager = mockobject.objects[MAIN_OBJ]
133
165
 
@@ -162,6 +194,16 @@ def AddSimpleModem(self):
162
194
  modem = mockobject.objects[modem_path]
163
195
  modem.AddProperties(MODEM_3GPP_IFACE, modem_3gpp_props)
164
196
 
197
+ modem_cell_broadcast_props = {
198
+ "CellBroadcasts": dbus.Array([], signature="o"),
199
+ }
200
+ modem_cell_broadcast_methods = [
201
+ ("List", "", "ao", listCbm),
202
+ ("Delete", "o", "", deleteCbm),
203
+ ]
204
+ modem.AddProperties(MODEM_CELL_BROADCAST_IFACE, modem_cell_broadcast_props)
205
+ modem.AddMethods(MODEM_CELL_BROADCAST_IFACE, modem_cell_broadcast_methods)
206
+
165
207
  modem_voice_props = {
166
208
  "Calls": dbus.Array([], signature="o"),
167
209
  "EmergencyOnly": False,
@@ -172,7 +214,6 @@ def AddSimpleModem(self):
172
214
  ("CallWaitingQuery", "", "b", "ret = self.call_waiting"),
173
215
  ("CallWaitingSetup", "b", "", "self.call_waiting = args[0]"),
174
216
  ]
175
- modem = mockobject.objects[modem_path]
176
217
  modem.AddProperties(MODEM_VOICE_IFACE, modem_voice_props)
177
218
  modem.AddMethods(MODEM_VOICE_IFACE, modem_voice_methods)
178
219
 
@@ -185,6 +226,7 @@ def AddSimpleModem(self):
185
226
  {
186
227
  MODEM_IFACE: modem_props,
187
228
  MODEM_3GPP_IFACE: modem_3gpp_props,
229
+ MODEM_CELL_BROADCAST_IFACE: modem_cell_broadcast_props,
188
230
  MODEM_VOICE_IFACE: modem_voice_props,
189
231
  },
190
232
  ],
@@ -196,14 +238,46 @@ def AddSimpleModem(self):
196
238
  "PreferredNetworks": dbus.Array([], signature="(su)"),
197
239
  }
198
240
  self.AddObject(sim_path, SIM_IFACE, sim_props, [])
199
- manager.EmitSignal(
200
- OBJECT_MANAGER_IFACE,
201
- "InterfacesAdded",
202
- "oa{sa{sv}}",
241
+
242
+ return (modem_path, sim_path)
243
+
244
+
245
+ @dbus.service.method(MOCK_IFACE, in_signature="uus", out_signature="s")
246
+ def AddCbm(self, state, channel, text):
247
+ """Convenience method to add a cell broadcast message
248
+
249
+ Returns the new object path.
250
+ """
251
+ n = 1
252
+ while mockobject.objects.get(f"/org/freedesktop/ModemManager1/Cbm/{n}") is not None:
253
+ n += 1
254
+ cbm_path = f"/org/freedesktop/ModemManager1/Cbm/{n}"
255
+
256
+ cbm_props = {
257
+ "State": dbus.UInt32(state),
258
+ "Channel": dbus.UInt32(channel),
259
+ "Text": dbus.String(text),
260
+ "MessageCode": dbus.UInt32(0),
261
+ "Update": dbus.UInt32(0),
262
+ }
263
+ self.AddObject(cbm_path, CBM_IFACE, cbm_props, [])
264
+
265
+ modem_obj = mockobject.objects[SIMPLE_MODEM_PATH]
266
+ paths = listCbm(self)
267
+ modem_obj.UpdateProperties(
268
+ MODEM_CELL_BROADCAST_IFACE,
269
+ {
270
+ "CellBroadcasts": dbus.Array(paths),
271
+ },
272
+ )
273
+
274
+ modem_obj.EmitSignal(
275
+ MODEM_CELL_BROADCAST_IFACE,
276
+ "Added",
277
+ "o",
203
278
  [
204
- dbus.ObjectPath(sim_path),
205
- {SIM_IFACE: sim_props},
279
+ dbus.ObjectPath(cbm_path),
206
280
  ],
207
281
  )
208
282
 
209
- return (modem_path, sim_path)
283
+ return cbm_path
@@ -196,7 +196,7 @@ def AddChargingBattery(self, device_name, model_name, percentage, seconds_to_ful
196
196
  @dbus.service.method(MOCK_IFACE, in_signature="uuddddxxbsu", out_signature="")
197
197
  def SetupDisplayDevice(
198
198
  self,
199
- _type,
199
+ _type, # noqa: RUF052, RUF100 (access to local dummy variable); but this is API now
200
200
  state,
201
201
  percentage,
202
202
  energy,
@@ -10,13 +10,14 @@ downstream_package_name: python-dbusmock
10
10
 
11
11
  actions:
12
12
  create-archive:
13
- - ./setup.py sdist
13
+ - python3 -m build --sdist
14
14
  # spec and tarball need to be in the same directory
15
- - sh -c 'mv dist/*.tar.* packaging; ls packaging/python[-_]dbusmock-*.tar.*'
15
+ - sh -c 'mv dist/*.tar.* packaging; ls packaging/python_dbusmock-*.tar.*'
16
16
 
17
17
  srpm_build_deps:
18
- - python3-setuptools
18
+ - python3-build
19
19
  - python3-setuptools_scm
20
+ - python3dist(wheel)
20
21
 
21
22
  jobs:
22
23
  - job: copr_build
@@ -24,16 +25,14 @@ jobs:
24
25
  targets:
25
26
  - fedora-all
26
27
  - centos-stream-9-x86_64
27
- # FIXME: broken
28
- # - centos-stream-10-x86_64
28
+ - centos-stream-10-x86_64
29
29
 
30
30
  - job: tests
31
31
  trigger: pull_request
32
32
  targets:
33
33
  - fedora-all
34
34
  - centos-stream-9-x86_64
35
- # FIXME: broken rpm build above
36
- # - centos-stream-10-x86_64
35
+ - centos-stream-10-x86_64
37
36
 
38
37
  - job: propose_downstream
39
38
  trigger: release
@@ -1,13 +1,178 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-dbusmock
3
- Version: 0.33.0
3
+ Version: 0.34.0
4
4
  Summary: Mock D-Bus objects
5
5
  Home-page: https://github.com/martinpitt/python-dbusmock
6
- Author: Martin Pitt
7
- Author-email: martin@piware.de
8
- License: LGPL 3+
9
6
  Download-URL: https://pypi.python.org/pypi/python-dbusmock/
10
- Platform: UNKNOWN
7
+ Author: Martin Pitt
8
+ Author-email: Martin Pitt <martin@piware.de>
9
+ License: GNU LESSER GENERAL PUBLIC LICENSE
10
+ Version 3, 29 June 2007
11
+
12
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
13
+ Everyone is permitted to copy and distribute verbatim copies
14
+ of this license document, but changing it is not allowed.
15
+
16
+
17
+ This version of the GNU Lesser General Public License incorporates
18
+ the terms and conditions of version 3 of the GNU General Public
19
+ License, supplemented by the additional permissions listed below.
20
+
21
+ 0. Additional Definitions.
22
+
23
+ As used herein, "this License" refers to version 3 of the GNU Lesser
24
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
25
+ General Public License.
26
+
27
+ "The Library" refers to a covered work governed by this License,
28
+ other than an Application or a Combined Work as defined below.
29
+
30
+ An "Application" is any work that makes use of an interface provided
31
+ by the Library, but which is not otherwise based on the Library.
32
+ Defining a subclass of a class defined by the Library is deemed a mode
33
+ of using an interface provided by the Library.
34
+
35
+ A "Combined Work" is a work produced by combining or linking an
36
+ Application with the Library. The particular version of the Library
37
+ with which the Combined Work was made is also called the "Linked
38
+ Version".
39
+
40
+ The "Minimal Corresponding Source" for a Combined Work means the
41
+ Corresponding Source for the Combined Work, excluding any source code
42
+ for portions of the Combined Work that, considered in isolation, are
43
+ based on the Application, and not on the Linked Version.
44
+
45
+ The "Corresponding Application Code" for a Combined Work means the
46
+ object code and/or source code for the Application, including any data
47
+ and utility programs needed for reproducing the Combined Work from the
48
+ Application, but excluding the System Libraries of the Combined Work.
49
+
50
+ 1. Exception to Section 3 of the GNU GPL.
51
+
52
+ You may convey a covered work under sections 3 and 4 of this License
53
+ without being bound by section 3 of the GNU GPL.
54
+
55
+ 2. Conveying Modified Versions.
56
+
57
+ If you modify a copy of the Library, and, in your modifications, a
58
+ facility refers to a function or data to be supplied by an Application
59
+ that uses the facility (other than as an argument passed when the
60
+ facility is invoked), then you may convey a copy of the modified
61
+ version:
62
+
63
+ a) under this License, provided that you make a good faith effort to
64
+ ensure that, in the event an Application does not supply the
65
+ function or data, the facility still operates, and performs
66
+ whatever part of its purpose remains meaningful, or
67
+
68
+ b) under the GNU GPL, with none of the additional permissions of
69
+ this License applicable to that copy.
70
+
71
+ 3. Object Code Incorporating Material from Library Header Files.
72
+
73
+ The object code form of an Application may incorporate material from
74
+ a header file that is part of the Library. You may convey such object
75
+ code under terms of your choice, provided that, if the incorporated
76
+ material is not limited to numerical parameters, data structure
77
+ layouts and accessors, or small macros, inline functions and templates
78
+ (ten or fewer lines in length), you do both of the following:
79
+
80
+ a) Give prominent notice with each copy of the object code that the
81
+ Library is used in it and that the Library and its use are
82
+ covered by this License.
83
+
84
+ b) Accompany the object code with a copy of the GNU GPL and this license
85
+ document.
86
+
87
+ 4. Combined Works.
88
+
89
+ You may convey a Combined Work under terms of your choice that,
90
+ taken together, effectively do not restrict modification of the
91
+ portions of the Library contained in the Combined Work and reverse
92
+ engineering for debugging such modifications, if you also do each of
93
+ the following:
94
+
95
+ a) Give prominent notice with each copy of the Combined Work that
96
+ the Library is used in it and that the Library and its use are
97
+ covered by this License.
98
+
99
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
100
+ document.
101
+
102
+ c) For a Combined Work that displays copyright notices during
103
+ execution, include the copyright notice for the Library among
104
+ these notices, as well as a reference directing the user to the
105
+ copies of the GNU GPL and this license document.
106
+
107
+ d) Do one of the following:
108
+
109
+ 0) Convey the Minimal Corresponding Source under the terms of this
110
+ License, and the Corresponding Application Code in a form
111
+ suitable for, and under terms that permit, the user to
112
+ recombine or relink the Application with a modified version of
113
+ the Linked Version to produce a modified Combined Work, in the
114
+ manner specified by section 6 of the GNU GPL for conveying
115
+ Corresponding Source.
116
+
117
+ 1) Use a suitable shared library mechanism for linking with the
118
+ Library. A suitable mechanism is one that (a) uses at run time
119
+ a copy of the Library already present on the user's computer
120
+ system, and (b) will operate properly with a modified version
121
+ of the Library that is interface-compatible with the Linked
122
+ Version.
123
+
124
+ e) Provide Installation Information, but only if you would otherwise
125
+ be required to provide such information under section 6 of the
126
+ GNU GPL, and only to the extent that such information is
127
+ necessary to install and execute a modified version of the
128
+ Combined Work produced by recombining or relinking the
129
+ Application with a modified version of the Linked Version. (If
130
+ you use option 4d0, the Installation Information must accompany
131
+ the Minimal Corresponding Source and Corresponding Application
132
+ Code. If you use option 4d1, you must provide the Installation
133
+ Information in the manner specified by section 6 of the GNU GPL
134
+ for conveying Corresponding Source.)
135
+
136
+ 5. Combined Libraries.
137
+
138
+ You may place library facilities that are a work based on the
139
+ Library side by side in a single library together with other library
140
+ facilities that are not Applications and are not covered by this
141
+ License, and convey such a combined library under terms of your
142
+ choice, if you do both of the following:
143
+
144
+ a) Accompany the combined library with a copy of the same work based
145
+ on the Library, uncombined with any other library facilities,
146
+ conveyed under the terms of this License.
147
+
148
+ b) Give prominent notice with the combined library that part of it
149
+ is a work based on the Library, and explaining where to find the
150
+ accompanying uncombined form of the same work.
151
+
152
+ 6. Revised Versions of the GNU Lesser General Public License.
153
+
154
+ The Free Software Foundation may publish revised and/or new versions
155
+ of the GNU Lesser General Public License from time to time. Such new
156
+ versions will be similar in spirit to the present version, but may
157
+ differ in detail to address new problems or concerns.
158
+
159
+ Each version is given a distinguishing version number. If the
160
+ Library as you received it specifies that a certain numbered version
161
+ of the GNU Lesser General Public License "or any later version"
162
+ applies to it, you have the option of following the terms and
163
+ conditions either of that published version or of any later version
164
+ published by the Free Software Foundation. If the Library as you
165
+ received it does not specify a version number of the GNU Lesser
166
+ General Public License, you may choose any version of the GNU Lesser
167
+ General Public License ever published by the Free Software Foundation.
168
+
169
+ If the Library as you received it specifies that a proxy can decide
170
+ whether future versions of the GNU Lesser General Public License shall
171
+ apply, that proxy's public statement of acceptance of any version is
172
+ permanent authorization for you to choose that version for the
173
+ Library.
174
+
175
+ Project-URL: homepage, https://github.com/martinpitt/python-dbusmock
11
176
  Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
12
177
  Classifier: Programming Language :: Python :: 3
13
178
  Classifier: Development Status :: 6 - Mature
@@ -19,8 +184,10 @@ Classifier: Topic :: Software Development :: Testing
19
184
  Classifier: Topic :: Software Development :: Testing :: Mocking
20
185
  Classifier: Topic :: Software Development :: Testing :: Unit
21
186
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
187
+ Requires-Python: >=3.8
22
188
  Description-Content-Type: text/markdown
23
189
  License-File: COPYING
190
+ Requires-Dist: dbus-python
24
191
 
25
192
  ![CI status](https://github.com/martinpitt/python-dbusmock/actions/workflows/tests.yml/badge.svg)
26
193
 
@@ -422,5 +589,3 @@ re-run all tests in the container shell like above. You can also run a specific
422
589
  test:
423
590
 
424
591
  python3 -m unittest tests.test_api.TestAPI.test_onearg_ret
425
-
426
-
@@ -38,13 +38,6 @@ wait
38
38
 
39
39
  my_version=\$(git describe --abbrev=0)
40
40
 
41
- # test sdist with direct setuptools
42
- ./setup.py sdist
43
- tar --wildcards --strip-components=1 -xvf dist/python[_-]dbusmock-\${my_version}*.tar.gz '*/PKG-INFO'
44
- grep "^Version: \${my_version}" PKG-INFO
45
- grep "^## Purpose" PKG-INFO
46
- git clean -ffdx
47
-
48
41
  # test sdist with PyPA build
49
42
  python3 -m build --sdist
50
43
  tar --wildcards --strip-components=1 -xvf dist/python_dbusmock-\${my_version}*.tar.gz '*/PKG-INFO'
@@ -38,13 +38,6 @@ wait
38
38
 
39
39
  my_version=\$(git describe --abbrev=0)
40
40
 
41
- # test sdist with direct setuptools
42
- ./setup.py sdist
43
- tar --wildcards --strip-components=1 -xvf dist/python[_-]dbusmock-\${my_version}*.tar.gz '*/PKG-INFO'
44
- grep "^Version: \${my_version}" PKG-INFO
45
- grep "^## Purpose" PKG-INFO
46
- git clean -ffdx
47
-
48
41
  # test sdist with PyPA build
49
42
  python3 -m build --sdist
50
43
  tar --wildcards --strip-components=1 -xvf dist/python_dbusmock-\${my_version}*.tar.gz '*/PKG-INFO'
@@ -21,7 +21,11 @@ import dbusmock
21
21
 
22
22
  dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
23
23
 
24
+ mmcli_has_cbm_support = False
24
25
  have_mmcli = shutil.which("mmcli")
26
+ if have_mmcli:
27
+ out = subprocess.run(["mmcli", "--help"], capture_output=True, text=True) # pylint: disable=subprocess-run-check
28
+ mmcli_has_cbm_support = "--help-cell-broadcast" in out.stdout
25
29
 
26
30
 
27
31
  class TestModemManagerBase(dbusmock.DBusTestCase):
@@ -136,6 +140,18 @@ class TestModemManagerModemMmcli(TestModemManagerMmcliBase):
136
140
  self.run_mmcli(["-m", "any", "--voice-status"])
137
141
  self.assertOutputContainsLine("emergency only: no\n")
138
142
 
143
+ @unittest.skipUnless(mmcli_has_cbm_support, "mmcli has no CBM suppot")
144
+ def test_cbm(self):
145
+ self.p_obj.AddSimpleModem()
146
+ self.p_obj.AddCbm(2, 4383, "This is a test")
147
+ self.run_mmcli(["-m", "any", "--cell-broadcast-list-cbm"])
148
+ self.assertOutputEquals(
149
+ [
150
+ " /org/freedesktop/ModemManager1/Cbm/1 (received)",
151
+ "",
152
+ ]
153
+ )
154
+
139
155
 
140
156
  if __name__ == "__main__":
141
157
  # avoid writing to stderr
@@ -338,7 +338,7 @@ class TestNetworkManager(dbusmock.DBusTestCase):
338
338
  self.assertRegex(self.read_device_wifi(), "The_SSID")
339
339
 
340
340
  self.dbusmock.RemoveAccessPoint(wifi1, ap1)
341
- self.assertFalse(re.compile("The_SSID").search(self.read_device_wifi()))
341
+ self.assertFalse(re.compile(r"The_SSID").search(self.read_device_wifi()))
342
342
 
343
343
  def test_add_connection(self):
344
344
  self.dbusmock.AddWiFiDevice("mock_WiFi1", "wlan0", DeviceState.ACTIVATED)
@@ -1,2 +0,0 @@
1
- assets:
2
- - path: dist/python-dbusmock*.tar.*
@@ -1 +0,0 @@
1
- __version__ = "0.33.0"
File without changes