mirror of https://github.com/fail2ban/fail2ban
TST: skip the test if a known problem with Python 2.6 is detected
As was original "discovered" while running tests on OSX with python2.6: http://nipy.bic.berkeley.edu/builders/fail2ban-py2.7-osx-10.6_master/builds/6/steps/shell_2/logs/stdiopull/699/head
parent
2bc509fcc7
commit
5e179f5dcb
|
@ -530,11 +530,27 @@ class Transmitter(TransmitterBase):
|
||||||
|
|
||||||
def testPythonActionMethodsAndProperties(self):
|
def testPythonActionMethodsAndProperties(self):
|
||||||
action = "TestCaseAction"
|
action = "TestCaseAction"
|
||||||
self.assertEqual(
|
try:
|
||||||
self.transm.proceed(["set", self.jailName, "addaction", action,
|
out = self.transm.proceed(
|
||||||
os.path.join(TEST_FILES_DIR, "action.d", "action.py"),
|
["set", self.jailName, "addaction", action,
|
||||||
'{"opt1": "value"}']),
|
os.path.join(TEST_FILES_DIR, "action.d", "action.py"),
|
||||||
(0, action))
|
'{"opt1": "value"}'])
|
||||||
|
self.assertEqual(out, (0, action))
|
||||||
|
except AssertionError:
|
||||||
|
if ((2, 6) <= sys.version_info < (2, 6, 5)) \
|
||||||
|
and '__init__() keywords must be strings' in out[1]:
|
||||||
|
# known issue http://bugs.python.org/issue2646 in 2.6 series
|
||||||
|
# since general Fail2Ban warnings are suppressed in normal
|
||||||
|
# operation -- let's issue Python's native warning here
|
||||||
|
import warnings
|
||||||
|
warnings.warn(
|
||||||
|
"Your version of Python %s seems to experience a known "
|
||||||
|
"issue forbidding correct operation of Fail2Ban: "
|
||||||
|
"http://bugs.python.org/issue2646 Upgrade your Python and "
|
||||||
|
"meanwhile other intestPythonActionMethodsAndProperties will "
|
||||||
|
"be skipped" % (sys.version))
|
||||||
|
return
|
||||||
|
raise
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
sorted(self.transm.proceed(["get", self.jailName,
|
sorted(self.transm.proceed(["get", self.jailName,
|
||||||
"actionproperties", action])[1]),
|
"actionproperties", action])[1]),
|
||||||
|
|
Loading…
Reference in New Issue