Unix: disable ipv6 test if ipv6 is disabled (eg. Travis).

This commit is contained in:
Valentin Lorentz 2017-08-18 23:03:06 +02:00
parent b02a124398
commit 0d7714d490
1 changed files with 19 additions and 7 deletions

View File

@ -28,11 +28,12 @@
### ###
import os import os
import socket
from supybot.test import * from supybot.test import *
try: try:
from unittest import skipIf from unittest import skip, skipIf
except ImportError: except ImportError:
def skipUnlessSpell(f): def skipUnlessSpell(f):
return None return None
@ -48,12 +49,23 @@ else:
'aspell/ispell not available.') 'aspell/ispell not available.')
skipUnlessFortune = skipIf(utils.findBinaryInPath('fortune') is None, skipUnlessFortune = skipIf(utils.findBinaryInPath('fortune') is None,
'fortune not available.') 'fortune not available.')
skipUnlessPing = skipIf(
utils.findBinaryInPath('ping') is None or not setuid, if network:
'ping not available.') skipUnlessPing = skipIf(
skipUnlessPing6 = skipIf( utils.findBinaryInPath('ping') is None or not setuid,
utils.findBinaryInPath('ping6') is None or not setuid, 'ping not available.')
'ping6 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): class UnixConfigTestCase(ChannelPluginTestCase):
plugins = ('Unix',) plugins = ('Unix',)