test-network: use specific exceptions instead of the Exception class

This commit is contained in:
Frantisek Sumsal
2022-02-03 19:30:11 +01:00
parent a561bceeaa
commit 54e2f32f50
+2 -2
View File
@@ -198,7 +198,7 @@ def expectedFailureIfNetdevsimWithSRIOVIsNotAvailable():
try:
with open('/sys/bus/netdevsim/new_device', mode='w') as f:
f.write('99 1')
except Exception:
except OSError:
return unittest.expectedFailure(func)
call('udevadm settle')
@@ -206,7 +206,7 @@ def expectedFailureIfNetdevsimWithSRIOVIsNotAvailable():
try:
with open('/sys/class/net/eni99np1/device/sriov_numvfs', mode='w') as f:
f.write('3')
except Exception:
except OSError:
call('rmmod netdevsim', stderr=subprocess.DEVNULL)
return unittest.expectedFailure(func)