def open(self, filename, *args, **kwargs):
"""
Attempt an open, but if the file is /dev/net/tun and it does not exist,
translate the error into L{SkipTest} so that tests that require
platform support for tuntap devices are skipped instead of failed.
"""
try:
return super(TestRealSystem, self).open(filename, *args, **kwargs)
except OSError as e:
# The device file may simply be missing. The device file may also
# exist but be unsupported by the kernel.
if e.errno in (ENOENT, ENODEV) and filename == b"/dev/net/tun":
raise SkipTest("Platform lacks /dev/net/tun")
raise
评论列表
文章目录