From dcbc93a117b0efaa0e42fa6359eed4a71a9ca341 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 10 Jun 2022 02:04:30 +0300 Subject: tests: Convert to formatted string literals Use formatted string literals to replace legacy printf-style string formatting. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- tests/kms-test-brxalloc.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'tests/kms-test-brxalloc.py') diff --git a/tests/kms-test-brxalloc.py b/tests/kms-test-brxalloc.py index af6dd49..7170ee6 100755 --- a/tests/kms-test-brxalloc.py +++ b/tests/kms-test-brxalloc.py @@ -38,12 +38,11 @@ class BRxAllocTest(kmstest.KMSTest): # Verify that the two CRTCs share the same planes planes = outputs[0].crtc.possible_planes if planes != outputs[1].crtc.possible_planes: - self.skip('Planes differ for CRTCs %u and %u' % \ - (outputs[0].crtc.id, outputs[1].crtc.id)) + self.skip(f'Planes differ for CRTCs {outputs[0].crtc.id} and {outputs[1].crtc.id}') return - self.logger.log('Found %u planes for CRTCs %u and %u' % \ - (len(planes), outputs[0].crtc.id, outputs[1].crtc.id)) + self.logger.log(f'Found {len(planes)} planes for CRTCs {outputs[0].crtc.id} ' + f'and {outputs[1].crtc.id}') # Get one connector for each CRTC for connector in self.output_connectors(): @@ -58,12 +57,12 @@ class BRxAllocTest(kmstest.KMSTest): outputs[1].connector = connector if not outputs[0].connector or not outputs[1].connector: - self.skip('No connected connectors for CRTCs %u and %u ' % \ - (outputs[0].crtc.id, outputs[1].crtc.id)) + self.skip(f'No connected connectors for CRTCs {outputs[0].crtc.id} ' + f'and {outputs[1].crtc.id}') return - self.start('Moving %u planes from %s to %s' % \ - (len(planes), outputs[0].connector.fullname, outputs[1].connector.fullname)) + self.start(f'Moving {len(planes)} planes from {outputs[0].connector.fullname} ' + f'to {outputs[0].connector.fullname}') # Set the initial mode for both outputs and wait 5s for the monitors to # wake up. @@ -76,8 +75,7 @@ class BRxAllocTest(kmstest.KMSTest): # Set the mode with no plane ret = self.atomic_crtc_mode_set(output.crtc, output.connector, mode, sync=True) if ret < 0: - self.fail('atomic mode set on %s failed with %d' % \ - (output.connector.fullname, ret)) + self.fail(f'atomic mode set on {output.connector.fullname} failed with {ret}') return self.logger.log('Initial atomic mode set completed') @@ -88,13 +86,13 @@ class BRxAllocTest(kmstest.KMSTest): output = outputs[0] for plane in planes: - self.logger.log('Adding plane %u to %s' % (plane.id, output.connector.fullname)) + self.logger.log(f'Adding plane {plane.id} to {output.connector.fullname}') source = kmstest.Rect(0, 0, output.fb.width, output.fb.height) destination = kmstest.Rect(offset, offset, output.fb.width, output.fb.height) ret = self.atomic_plane_set(plane, output.crtc, source, destination, output.fb, sync=True) if ret < 0: - self.fail('atomic plane set failed with %d' % ret) + self.fail(f'atomic plane set failed with {ret}') return offset += 50 @@ -106,20 +104,20 @@ class BRxAllocTest(kmstest.KMSTest): output = outputs[1] for plane in planes: - self.logger.log('Moving plane %u to %s' % (plane.id, output.connector.fullname)) + self.logger.log(f'Moving plane {plane.id} to {output.connector.fullname}') # Switching CRTC directly is not supported by DRM, start by # disabling the plane. ret = self.atomic_plane_disable(plane) if ret < 0: - self.fail('atomic plane disable failed with %d' % ret) + self.fail(f'atomic plane disable failed with {ret}') return source = kmstest.Rect(0, 0, output.fb.width, output.fb.height) destination = kmstest.Rect(offset, offset, output.fb.width, output.fb.height) ret = self.atomic_plane_set(plane, output.crtc, source, destination, output.fb) if ret < 0: - self.fail('atomic plane set failed with %d' % ret) + self.fail(f'atomic plane set failed with {ret}') return self.run(1) -- cgit v1.2.3