summaryrefslogtreecommitdiff
path: root/pyflakes/test/test_api.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyflakes/test/test_api.py')
-rw-r--r--pyflakes/test/test_api.py23
1 files changed, 7 insertions, 16 deletions
diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py
index b579ac8..8e1e3c9 100644
--- a/pyflakes/test/test_api.py
+++ b/pyflakes/test/test_api.py
@@ -515,7 +515,7 @@ def foo(bar=baz, bax):
"""
with self.makeTempFile(source) as sourcePath:
if ERROR_HAS_LAST_LINE:
- if PYPY and sys.version_info >= (3,):
+ if PYPY:
column = 7
elif sys.version_info >= (3, 8):
column = 9
@@ -543,7 +543,7 @@ foo(bar=baz, bax)
"""
with self.makeTempFile(source) as sourcePath:
if ERROR_HAS_LAST_LINE:
- if PYPY and sys.version_info >= (3,):
+ if PYPY:
column = 12
elif sys.version_info >= (3, 8):
column = 14
@@ -578,7 +578,7 @@ foo(bar=baz, bax)
else:
position_end = 1
if PYPY:
- column = 6
+ column = 5
else:
column = 7
# Column has been "fixed" since 3.2.4 and 3.3.1
@@ -717,13 +717,6 @@ class IntegrationTests(TestCase):
"""
Tests of the pyflakes script that actually spawn the script.
"""
-
- # https://bitbucket.org/pypy/pypy/issues/3069/pypy36-on-windows-incorrect-line-separator
- if PYPY and sys.version_info >= (3,) and WIN:
- LINESEP = '\n'
- else:
- LINESEP = os.linesep
-
def setUp(self):
self.tempdir = tempfile.mkdtemp()
self.tempfilepath = os.path.join(self.tempdir, 'temp')
@@ -784,7 +777,7 @@ class IntegrationTests(TestCase):
fd.write("import contraband\n".encode('ascii'))
d = self.runPyflakes([self.tempfilepath])
expected = UnusedImport(self.tempfilepath, Node(1), 'contraband')
- self.assertEqual(d, ("%s%s" % (expected, self.LINESEP), '', 1))
+ self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))
def test_errors_io(self):
"""
@@ -794,7 +787,7 @@ class IntegrationTests(TestCase):
"""
d = self.runPyflakes([self.tempfilepath])
error_msg = '%s: No such file or directory%s' % (self.tempfilepath,
- self.LINESEP)
+ os.linesep)
self.assertEqual(d, ('', error_msg, 1))
def test_errors_syntax(self):
@@ -807,7 +800,7 @@ class IntegrationTests(TestCase):
fd.write("import".encode('ascii'))
d = self.runPyflakes([self.tempfilepath])
error_msg = '{0}:1:{2}: invalid syntax{1}import{1} {3}^{1}'.format(
- self.tempfilepath, self.LINESEP, 6 if PYPY else 7, '' if PYPY else ' ')
+ self.tempfilepath, os.linesep, 6 if PYPY else 7, '' if PYPY else ' ')
self.assertEqual(d, ('', error_msg, 1))
def test_readFromStdin(self):
@@ -816,15 +809,13 @@ class IntegrationTests(TestCase):
"""
d = self.runPyflakes([], stdin='import contraband')
expected = UnusedImport('<stdin>', Node(1), 'contraband')
- self.assertEqual(d, ("%s%s" % (expected, self.LINESEP), '', 1))
+ self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1))
class TestMain(IntegrationTests):
"""
Tests of the pyflakes main function.
"""
- LINESEP = os.linesep
-
def runPyflakes(self, paths, stdin=None):
try:
with SysStreamCapturing(stdin) as capture: