From 0d7714d490a088ccb8eee79cb6bbd1f3cf9f30c9 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 18 Aug 2017 23:03:06 +0200 Subject: [PATCH] Unix: disable ipv6 test if ipv6 is disabled (eg. Travis). --- plugins/Unix/test.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/plugins/Unix/test.py b/plugins/Unix/test.py index 9ca7df64e..842e6952b 100644 --- a/plugins/Unix/test.py +++ b/plugins/Unix/test.py @@ -28,11 +28,12 @@ ### import os +import socket from supybot.test import * try: - from unittest import skipIf + from unittest import skip, skipIf except ImportError: def skipUnlessSpell(f): return None @@ -48,12 +49,23 @@ else: 'aspell/ispell not available.') skipUnlessFortune = skipIf(utils.findBinaryInPath('fortune') is None, 'fortune not available.') - skipUnlessPing = skipIf( - utils.findBinaryInPath('ping') is None or not setuid, - 'ping not available.') - skipUnlessPing6 = skipIf( - utils.findBinaryInPath('ping6') is None or not setuid, - 'ping6 not available.') + + if network: + skipUnlessPing = skipIf( + utils.findBinaryInPath('ping') is None or not setuid, + 'ping not available.') + if socket.has_ipv6: + skipUnlessPing6 = skipIf( + utils.findBinaryInPath('ping6') is None or not setuid, + 'ping6 not available.') + else: + skipUnlessPing6 = skip( + 'IPv6 not available.') + else: + skipUnlessPing = skip( + 'network not available.') + skipUnlessPing6 = skip( + 'network not available.') class UnixConfigTestCase(ChannelPluginTestCase): plugins = ('Unix',)