Skip to content

Commit

Permalink
Make shell tests work on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jnmclarty committed Jun 2, 2016
1 parent 64332d8 commit 8aca5d4
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions testsuite/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@
from testsuite.support import ROOT_DIR, PseudoFile


def safe_line_split(line):
split = line.split(':')
if 'win' in sys.platform:
try:
drive, path, x, y, msg = split
path = drive + ':' + path
except:
path, x, y, msg = split
else:
path, x, y, msg = split
return path, x, y, msg


class ShellTestCase(unittest.TestCase):
"""Test the usual CLI options and output."""

Expand Down Expand Up @@ -77,7 +90,7 @@ def test_check_simple(self):
self.assertFalse(stderr)
self.assertEqual(len(stdout), 17)
for line, num, col in zip(stdout, (3, 6, 9, 12), (3, 6, 1, 5)):
path, x, y, msg = line.split(':')
path, x, y, msg = safe_line_split(line)
self.assertTrue(path.endswith(E11))
self.assertEqual(x, str(num))
self.assertEqual(y, str(col))
Expand Down Expand Up @@ -141,7 +154,7 @@ def test_check_diff(self):
self.assertEqual(errcode, 1)
self.assertFalse(stderr)
for line, num, col in zip(stdout, (3, 6), (3, 6)):
path, x, y, msg = line.split(':')
path, x, y, msg = safe_line_split(line)
self.assertEqual(x, str(num))
self.assertEqual(y, str(col))
self.assertTrue(msg.startswith(' E11'))
Expand All @@ -154,7 +167,7 @@ def test_check_diff(self):
self.assertEqual(errcode, 1)
self.assertFalse(stderr)
for line, num, col in zip(stdout, (3, 6), (3, 6)):
path, x, y, msg = line.split(':')
path, x, y, msg = safe_line_split(line)
self.assertEqual(x, str(num))
self.assertEqual(y, str(col))
self.assertTrue(msg.startswith(' E11'))
Expand Down

0 comments on commit 8aca5d4

Please sign in to comment.