mirror of https://github.com/fail2ban/fail2ban
BF: fixed up conditioning of tests under cygwin (still 3 fail)
parent
a120ff191a
commit
2aa8ddea4d
|
@ -67,10 +67,12 @@ option = %s
|
||||||
os.chmod(f, 0)
|
os.chmod(f, 0)
|
||||||
# fragile test and known to fail e.g. under Cygwin where permissions
|
# fragile test and known to fail e.g. under Cygwin where permissions
|
||||||
# seems to be not enforced, thus condition
|
# seems to be not enforced, thus condition
|
||||||
if not os.access('d.conf', os.R_OK):
|
if not os.access(f, os.R_OK):
|
||||||
self.assertFalse(self.c.read('d')) # should not be readable BUT present
|
self.assertFalse(self.c.read('d')) # should not be readable BUT present
|
||||||
else:
|
else:
|
||||||
raise unittest.SkipTest("Skipping on %s -- access rights are not enforced" % platform)
|
# SkipTest introduced only in 2.7 thus can't yet use generally
|
||||||
|
# raise unittest.SkipTest("Skipping on %s -- access rights are not enforced" % platform)
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def testOptionalDotDDir(self):
|
def testOptionalDotDDir(self):
|
||||||
|
|
|
@ -84,9 +84,8 @@ def _assert_equal_entries(utest, found, output, count=None):
|
||||||
if len(output) > 3 and count is None: # match matches
|
if len(output) > 3 and count is None: # match matches
|
||||||
# do not check if custom count (e.g. going through them twice)
|
# do not check if custom count (e.g. going through them twice)
|
||||||
if os.linesep != '\n' or sys.platform.startswith('cygwin'):
|
if os.linesep != '\n' or sys.platform.startswith('cygwin'):
|
||||||
# on those where text file lines end with '\r\n', override
|
# on those where text file lines end with '\r\n', remove '\r'
|
||||||
# repr for this test to disregard trailing CR LF
|
srepr = lambda x: repr(x).replace(r'\r', '')
|
||||||
srepr = lambda x: repr(str(x).rstrip('\n\r'))
|
|
||||||
else:
|
else:
|
||||||
srepr = repr
|
srepr = repr
|
||||||
utest.assertEqual(srepr(found[3]), srepr(output[3]))
|
utest.assertEqual(srepr(found[3]), srepr(output[3]))
|
||||||
|
|
Loading…
Reference in New Issue