diff --git a/examples/strategy/test_uboot_strategy.py b/examples/strategy/test_uboot_strategy.py index 59ce20c66..8fa2b0263 100644 --- a/examples/strategy/test_uboot_strategy.py +++ b/examples/strategy/test_uboot_strategy.py @@ -5,7 +5,7 @@ def strategy(target): try: return target.get_driver('UBootStrategy') - except: + except NoDriverFoundError: pytest.skip("strategy not found") diff --git a/labgrid/autoinstall/main.py b/labgrid/autoinstall/main.py index d1ba5eda5..3406e4ad1 100644 --- a/labgrid/autoinstall/main.py +++ b/labgrid/autoinstall/main.py @@ -73,7 +73,7 @@ def run(self): self.context['target'] = self.target if self.target is None: raise KeyError - except: + except Exception: # pylint: disable=broad-except self.log.exception("target creation failed") return @@ -123,7 +123,7 @@ def run_once(self): next(iter(e.filter))) else: self.log.warning("resource not found, restarting") - except: + except Exception: # pylint: disable=broad-except self.log.exception("handler failed") return False diff --git a/labgrid/remote/client.py b/labgrid/remote/client.py index 0ec5e4a2e..8b3735d65 100755 --- a/labgrid/remote/client.py +++ b/labgrid/remote/client.py @@ -1243,7 +1243,7 @@ def main(): exitcode = 1 except KeyboardInterrupt: exitcode = 0 - except: + except Exception: # pylint: disable=broad-except traceback.print_exc() exitcode = 2 exit(exitcode) diff --git a/labgrid/remote/coordinator.py b/labgrid/remote/coordinator.py index 9e8b2eae6..896b8f684 100644 --- a/labgrid/remote/coordinator.py +++ b/labgrid/remote/coordinator.py @@ -223,7 +223,7 @@ async def poll(self): await self._poll_step() except asyncio.CancelledError: break - except: + except Exception: # pylint: disable=broad-except traceback.print_exc() def save_later(self): diff --git a/labgrid/remote/exporter.py b/labgrid/remote/exporter.py index 5c42e9ad4..f4852989c 100755 --- a/labgrid/remote/exporter.py +++ b/labgrid/remote/exporter.py @@ -18,7 +18,7 @@ try: import pkg_resources __version__ = pkg_resources.get_distribution('labgrid').version -except: +except pkg_resources.DistributionNotFound: __version__ = "unknown" def get_free_port(): @@ -351,7 +351,7 @@ async def onJoin(self, details): group_name, resource_name, cls, params ) - except: + except Exception: # pylint: disable=broad-except traceback.print_exc() self.loop.stop() return @@ -400,7 +400,7 @@ async def _poll_step(self): continue try: changed = resource.poll() - except: + except Exception: # pylint: disable=broad-except print("Exception while polling {}".format(resource), file=sys.stderr) traceback.print_exc() continue @@ -420,7 +420,7 @@ async def poll(self): await self._poll_step() except asyncio.CancelledError: break - except: + except Exception: # pylint: disable=broad-except traceback.print_exc() async def add_resource(self, group_name, resource_name, cls, params): diff --git a/labgrid/resource/ethernetport.py b/labgrid/resource/ethernetport.py index ef9847a93..0dbd0353f 100644 --- a/labgrid/resource/ethernetport.py +++ b/labgrid/resource/ethernetport.py @@ -245,7 +245,7 @@ async def poll(self, handler): await handler(self) except asyncio.CancelledError: break - except: + except Exception: # pylint: disable=broad-except import traceback traceback.print_exc() diff --git a/labgrid/step.py b/labgrid/step.py index 88ad51045..0cc7a4663 100644 --- a/labgrid/step.py +++ b/labgrid/step.py @@ -40,7 +40,7 @@ def notify(self, event): for subscriber in self._subscribers: try: subscriber(event) - except Exception as e: + except Exception as e: # pylint: disable=broad-except warnings.warn("unhandled exception during event notification: {}".format(e)) steps = Steps() diff --git a/labgrid/util/agent.py b/labgrid/util/agent.py index a55568e62..580c3b423 100644 --- a/labgrid/util/agent.py +++ b/labgrid/util/agent.py @@ -30,7 +30,7 @@ def run(self): try: request = json.loads(line) - except: + except json.JSONDecodeError: self._send({'error': 'request parsing failed'}) break