Skip to content

Commit

Permalink
q-dev: update tests and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed Jun 12, 2024
1 parent c347bfe commit 2969817
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions qubes/device_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,10 +560,10 @@ def interfaces(self) -> List[DeviceInterface]:
@property
def parent_device(self) -> Optional[Device]:
"""
The parent device if any.
The parent device, if any.
If the device is part of another device (e.g. it's a single
partition of an usb stick), the parent device id should be here.
If the device is part of another device (e.g., it's a single
partition of a USB stick), the parent device id should be here.
"""
return self._parent

Expand All @@ -572,7 +572,7 @@ def subdevices(self) -> List['DeviceInfo']:
"""
The list of children devices if any.
If the device has subdevices (e.g. partitions of an usb stick),
If the device has subdevices (e.g., partitions of a USB stick),
the subdevices id should be here.
"""
return [dev for dev in self.backend_domain.devices[self.devclass]
Expand Down Expand Up @@ -604,7 +604,7 @@ def serialize(self) -> bytes:

if self.attachment:
properties = self.pack_property(
properties, 'attachment', self.attachment.name)
'attachment', self.attachment.name)

properties += b' ' + self.pack_property(
'interfaces',
Expand Down Expand Up @@ -742,6 +742,7 @@ def sanitize_str(
if replace_char is None:
not_allowed_chars = set(untrusted_value) - allowed_chars
if not_allowed_chars:
print(untrusted_value)
raise ProtocolError(error_message + repr(not_allowed_chars))
return untrusted_value
result = ""
Expand Down
2 changes: 1 addition & 1 deletion qubes/tests/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def test_030_serialize_and_deserialize(self):
serial=None,
interfaces=[DeviceInterface(" 112233"),
DeviceInterface("&012345")],
**{"additional info": "and='more'", "date": "06.12.23"}
**{"additional_info": "and='more'", "date": "06.12.23"}
)
serialized = device.serialize()
deserialized = DeviceInfo.deserialize(b'1-1.1.1 ' + serialized, self.vm)
Expand Down
2 changes: 1 addition & 1 deletion qubes/tests/vm/qubesvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,7 @@ def test_600_libvirt_xml_hvm_pcidev(self):
vm, # this is violation of API, but for PCI the argument
# is unused
'00_00.0',
bus='pci',
devclass='pci',
persistent=True)
vm.devices['pci']._set.add(
assignment)
Expand Down

0 comments on commit 2969817

Please sign in to comment.