diff --git a/test/test_vapi.py b/test/test_vapi.py
index 5a04abe..6817fae 100644
--- a/test/test_vapi.py
+++ b/test/test_vapi.py
@@ -9,7 +9,7 @@
 
 
 class VAPITestCase(VppTestCase):
-    """ VAPI test """
+    """VAPI test"""
 
     @classmethod
     def setUpClass(cls):
@@ -20,10 +20,11 @@
         super(VAPITestCase, cls).tearDownClass()
 
     def test_vapi_c(self):
-        """ run C VAPI tests """
+        """run C VAPI tests"""
         executable = f"{config.vpp_build_dir}/vpp/bin/vapi_c_test"
-        worker = Worker([executable, "vapi client",
-                         self.get_api_segment_prefix()], self.logger)
+        worker = Worker(
+            [executable, "vapi client", self.get_api_segment_prefix()], self.logger
+        )
         worker.start()
         timeout = 60
         worker.join(timeout)
@@ -32,23 +33,22 @@
         if worker.result is None:
             try:
                 error = True
-                self.logger.error(
-                    "Timeout! Worker did not finish in %ss" % timeout)
+                self.logger.error("Timeout! Worker did not finish in %ss" % timeout)
                 os.killpg(os.getpgid(worker.process.pid), signal.SIGTERM)
                 worker.join()
             except:
                 self.logger.debug("Couldn't kill worker-spawned process")
                 raise
         if error:
-            raise Exception(
-                "Timeout! Worker did not finish in %ss" % timeout)
+            raise Exception("Timeout! Worker did not finish in %ss" % timeout)
         self.assert_equal(worker.result, 0, "Binary test return code")
 
     def test_vapi_cpp(self):
-        """ run C++ VAPI tests """
+        """run C++ VAPI tests"""
         executable = f"{config.vpp_build_dir}/vpp/bin/vapi_cpp_test"
-        worker = Worker([executable, "vapi client",
-                         self.get_api_segment_prefix()], self.logger)
+        worker = Worker(
+            [executable, "vapi client", self.get_api_segment_prefix()], self.logger
+        )
         worker.start()
         timeout = 120
         worker.join(timeout)
@@ -57,17 +57,15 @@
         if worker.result is None:
             try:
                 error = True
-                self.logger.error(
-                    "Timeout! Worker did not finish in %ss" % timeout)
+                self.logger.error("Timeout! Worker did not finish in %ss" % timeout)
                 os.killpg(os.getpgid(worker.process.pid), signal.SIGTERM)
                 worker.join()
             except:
                 raise Exception("Couldn't kill worker-spawned process")
         if error:
-            raise Exception(
-                "Timeout! Worker did not finish in %ss" % timeout)
+            raise Exception("Timeout! Worker did not finish in %ss" % timeout)
         self.assert_equal(worker.result, 0, "Binary test return code")
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     unittest.main(testRunner=VppTestRunner)
