Skip to content

Commit 7ebcfeb

Browse files
committed
Merge pull request #33 from alexandrul/master
Fix test_api.py on Windows
2 parents 237e49d + 24c2aa8 commit 7ebcfeb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pyflakes/test/test_api.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
checkRecursive,
1616
iterSourceCode,
1717
)
18-
from pyflakes.test.harness import TestCase
18+
from pyflakes.test.harness import TestCase, skipIf
1919

2020
if sys.version_info < (3,):
2121
from cStringIO import StringIO
@@ -419,6 +419,7 @@ def test_invalidEscape(self):
419419
self.assertHasErrors(
420420
sourcePath, [decoding_error])
421421

422+
@skipIf(sys.platform == 'win32', 'unsupported on Windows')
422423
def test_permissionDenied(self):
423424
"""
424425
If the source file is not readable, this is reported on standard
@@ -583,7 +584,7 @@ def test_fileWithFlakes(self):
583584
fd.close()
584585
d = self.runPyflakes([self.tempfilepath])
585586
expected = UnusedImport(self.tempfilepath, Node(1), 'contraband')
586-
self.assertEqual(d, ("%s\n" % expected, '', 1))
587+
self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))
587588

588589
def test_errors(self):
589590
"""
@@ -592,7 +593,8 @@ def test_errors(self):
592593
printed to stderr.
593594
"""
594595
d = self.runPyflakes([self.tempfilepath])
595-
error_msg = '%s: No such file or directory\n' % (self.tempfilepath,)
596+
error_msg = '%s: No such file or directory%s' % (self.tempfilepath,
597+
os.linesep)
596598
self.assertEqual(d, ('', error_msg, 1))
597599

598600
def test_readFromStdin(self):
@@ -601,4 +603,4 @@ def test_readFromStdin(self):
601603
"""
602604
d = self.runPyflakes([], stdin='import contraband'.encode('ascii'))
603605
expected = UnusedImport('<stdin>', Node(1), 'contraband')
604-
self.assertEqual(d, ("%s\n" % expected, '', 1))
606+
self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))

0 commit comments

Comments
 (0)