-
Notifications
You must be signed in to change notification settings - Fork 51
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
mockobject: Allow adding objects derived from DBusMockObject #218
mockobject: Allow adding objects derived from DBusMockObject #218
Conversation
I want to use this in the mutter test suite: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4022/diffs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Sorry for the late review, I missed that during my vacation.
This makes sense, but needs documentation (in the docstrings) and unit tests. Please let me know if you need help with either.
bbcb469
to
13fa944
Compare
Tried to add documentation and a unit test. Let me know if it needs adjusting. |
@swick thanks! I'm AFK until next Wednesday, will re-review then. But at a quick glance this looks great! |
There's some pylint/ruff/black failures, see test failure. If you don't feel like fixing these (installing these tools and running the tests), I'm happy to do that, too. |
13fa944
to
dc6a386
Compare
I think I managed to fix it. If something is still wrong, feel free to take over. |
We are going to add an 8th argument to the DBusMockObject constructor.
This allows to create objects instanciated from a DBusMockObject subclass in mock templates. That way, implementing dynamic objects becomes easier by using dbus decorators. This also allows passing some extra data to the DBusMockObject derived class constructor so it becomes possible to store some data in the object created via DBusMockObject.add_object which can be useful if one e.g. needs some information stored in the parent object.
dc6a386
to
247d50b
Compare
Thanks @swick ! I rebased, fixed a trivial black error, and some docstring formatting. |
Thank you! |
Hey @martinpitt, we would like to depend on this change for mutter. Any chance we can get a release soon? |
@swick Oh sorry, I thought this was already included in 0.32.2, but that was a few days earlier. No problem! New release: https://github.com/martinpitt/python-dbusmock/releases/tag/0.33.0 Packaging for Fedora/Debian/Ubuntu now. |
Thank you very much again! |
This allows to create objects instanciated from a DBusMockObject subclass in mock templates. That way, implementing dynamic objects becomes easier by using dbus decorators: