-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PyPy2 Windows IntegrationTests #76
Merged
sigmavirus24
merged 1 commit into
PyCQA:master
from
jayvdb:fix-pypy2-testintegration-stderr
Aug 4, 2016
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,46 @@ | ||
# To activate, change the Appveyor settings to use `.appveyor.yml`. | ||
install: | ||
- python -m pip install tox | ||
- python -m pip install --upgrade virtualenv pip setuptools tox | ||
|
||
# Fetch the three main PyPy releases | ||
- ps: (New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy-2.6.1-win32.zip', "$env:appveyor_build_folder\pypy-2.6.1-win32.zip") | ||
- ps: 7z x pypy-2.6.1-win32.zip | Out-Null | ||
- move pypy-2.6.1-win32 C:\ | ||
|
||
- ps: (New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.3.1-win32.zip', "$env:appveyor_build_folder\pypy2-v5.3.1-win32.zip") | ||
- ps: 7z x pypy2-v5.3.1-win32.zip | Out-Null | ||
- move pypy2-v5.3.1-win32 C:\ | ||
|
||
- ps: (New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-win32.zip', "$env:appveyor_build_folder\pypy3-2.4.0-win32.zip") | ||
- ps: 7z x pypy3-2.4.0-win32.zip | Out-Null | ||
- move pypy3-2.4.0-win32 C:\ | ||
|
||
# pypy3 installer provides 'pypy.exe', not pypy3.exe. | ||
- copy C:\pypy3-2.4.0-win32\pypy.exe C:\pypy3-2.4.0-win32\pypy3.exe | ||
|
||
# workaround https://github.com/pypa/virtualenv/issues/93 | ||
- mkdir C:\python33\tcl\tcl8.6 | ||
- mkdir C:\python33\tcl\tk8.6 | ||
- mkdir C:\pypy3-2.4.0-win32\tcl\tcl8.6 | ||
- mkdir C:\pypy3-2.4.0-win32\tcl\tk8.6 | ||
|
||
# Only pypy2-5.3.1 is integrated into tox, as pypy3-2.4.0 fails and | ||
# a Windows distribution of pypy3-5.2 isnt available yet. | ||
- ps: $env:path = "$env:path;C:\pypy2-v5.3.1-win32" | ||
|
||
# pypy3-2.4.0 and pypy-2.6.1 are manually bootstrapped and tested | ||
- ps: (New-Object Net.WebClient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', "$env:appveyor_build_folder\get-pip.py") | ||
- git clone https://github.com/pypa/setuptools/ | ||
- cd setuptools | ||
- C:\pypy3-2.4.0-win32\pypy3 bootstrap.py | ||
- C:\pypy3-2.4.0-win32\pypy3 setup.py install | ||
- C:\pypy-2.6.1-win32\pypy bootstrap.py | ||
- C:\pypy-2.6.1-win32\pypy setup.py install | ||
- cd .. | ||
|
||
build: off | ||
|
||
test_script: | ||
- python -m tox | ||
- C:\pypy3-2.4.0-win32\pypy3 setup.py test -q | ||
- C:\pypy-2.6.1-win32\pypy setup.py test -q |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
import subprocess | ||
import tempfile | ||
|
||
from pyflakes.checker import PY2 | ||
from pyflakes.messages import UnusedImport | ||
from pyflakes.reporter import Reporter | ||
from pyflakes.api import ( | ||
|
@@ -30,6 +31,12 @@ | |
except AttributeError: | ||
PYPY = False | ||
|
||
try: | ||
WindowsError | ||
WIN = True | ||
except NameError: | ||
WIN = False | ||
|
||
ERROR_HAS_COL_NUM = ERROR_HAS_LAST_LINE = sys.version_info >= (3, 2) or PYPY | ||
|
||
|
||
|
@@ -661,6 +668,9 @@ def runPyflakes(self, paths, stdin=None): | |
if sys.version_info >= (3,): | ||
stdout = stdout.decode('utf-8') | ||
stderr = stderr.decode('utf-8') | ||
# Workaround https://bitbucket.org/pypy/pypy/issues/2350 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks like there will be a fix in the next release |
||
if PYPY and PY2 and WIN: | ||
stderr = stderr.replace('\r\r\n', '\r\n') | ||
return (stdout, stderr, rv) | ||
|
||
def test_goodFile(self): | ||
|
@@ -685,7 +695,7 @@ def test_fileWithFlakes(self): | |
expected = UnusedImport(self.tempfilepath, Node(1), 'contraband') | ||
self.assertEqual(d, ("%s%s" % (expected, os.linesep), '', 1)) | ||
|
||
def test_errors(self): | ||
def test_errors_io(self): | ||
""" | ||
When pyflakes finds errors with the files it's given, (if they don't | ||
exist, say), then the return code is non-zero and the errors are | ||
|
@@ -696,6 +706,20 @@ def test_errors(self): | |
os.linesep) | ||
self.assertEqual(d, ('', error_msg, 1)) | ||
|
||
def test_errors_syntax(self): | ||
""" | ||
When pyflakes finds errors with the files it's given, (if they don't | ||
exist, say), then the return code is non-zero and the errors are | ||
printed to stderr. | ||
""" | ||
fd = open(self.tempfilepath, 'wb') | ||
fd.write("import".encode('ascii')) | ||
fd.close() | ||
d = self.runPyflakes([self.tempfilepath]) | ||
error_msg = '{0}:1:{2}: invalid syntax{1}import{1} {3}^{1}'.format( | ||
self.tempfilepath, os.linesep, 5 if PYPY else 7, '' if PYPY else ' ') | ||
self.assertEqual(d, ('', error_msg, True)) | ||
|
||
def test_readFromStdin(self): | ||
""" | ||
If no arguments are passed to C{pyflakes} then it reads from stdin. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.6 is ... well very old. Why are we supporting that on Windows? That seems wasteful to say the least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Despite its very low number, 2.6.1 is not old. It was released only a year ago. That series is/was the stable release. PyPy 2.6.1 is
sys.version_info
2.7.10, which is the same as the latest PyPy2 5.x release, and it gets those users past the Python SSL problems. PyPy 5.x appears to be gaining traction as a replacement for PyPy 2.x.Also, it costs us almost nothing? The time to add it to the image is negligible. There are no Windows specific bugs related to PyPy 2.x series; the only Windows specific bug anywhere in pyflakes is https://bitbucket.org/pypy/pypy/issues/2350 , which also occurs on the latest PyPy2 5.x release, and it is only a problem with our test framework -- not the program end-users are faced with.
As we test against Travis
python: pypy
, which is PyPy2.5 (sys.version_info
2.7.8), IMO it makes sense to bring our Windows testing to roughly the same level.Without evidence otherwise, Windows users have been able to use pyflakes on PyPy2.x , and by adding this to the test matrix we ensure that if/when we do break that, we do it intentionally.
I expect we'd break it when Travis stops providing a 2.5/2.6 by default, or the existing pypy 2.5/2.6 workarounds start to really hurt. (afaik, the only painful aspect is the different column offsets in their error messages, which we should raise a bug in pypy so that problem can whittle away over time.)
I expect PyPy3 2.4 will be the first to be killed. While it has been added to this test matrix, I would be only too happy to remove it entirely just as soon as they provide a -win release of PyPy3 5.x, as it is Python 3.2, and anybody using that in production a second longer than they need to has bigger problems than their syntax checker no longer working.