diff --git a/tests/test_dns_records.py b/tests/test_dns_records.py
index 513cd117687230ab15ee5dcceca6d53ec60e1924..a513bdc23a195686da77b0756cc411f279d63cf4 100755
--- a/tests/test_dns_records.py
+++ b/tests/test_dns_records.py
@@ -36,7 +36,7 @@ def get_dns_servers() -> set:
         servers.extend(
             [":".join(map(str, dns[2])) for dns in bus_client.DNS if dns[1] == 10]
         )  # IPv6
-    except:
+    except Exception:
         pass
 
     # network-manager method