Skip to content

Make tests runnable on Windows and add appveyor.yaml #1593

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

Merged
merged 4 commits into from
Jun 6, 2016

Conversation

gvanrossum
Copy link
Member

This is an improved version of #1504 by James Tatum(@jtatum) -- I had some feedback but James seems to have dropped out so I am picking up the torch. My contribution is to avoid having to change [out] to [out pathfix]; instead the test code has to pass native_sep=True to parse_test_cases(). The latter function will then translate / to \, but only in the filename part of error messages (the original code just did line.replace('/', '\\'), which would translate slashes in error messages too).

Maybe we can get into the upcoming release yet? It doesn't change anything to type checking, and it will make testing on Windows easier and automatic. I've already signed up for appveyor: https://ci.appveyor.com/project/gvanrossum/mypy.

James Tatum and others added 4 commits May 28, 2016 15:44
Waiter depended on a couple of posix tricks. The first was a clever
use of os.waitpid(-1, 0) to wait for any spawned processes to return.
On Windows, this raises an exception - Windows has no concept of a
process group.

The second was the use of NamedTempFile(). On anything but Windows,
a file can be open for writing and for reading at the same time.
This trick actually isn't necessary the way NamedTempFile is used
here. It exposes a file-like object pointing to a file already opened
in binary mode. All we have to do is seek and read from it.
The only tricky bit of this is renaming python.exe to python2.exe.
This is due to util.try_find_python2_interpreter(), which may well
need work for Windows since the version symlinks don't exist on Windows.
Most of these fixes revolve around the path separator and the way
Windows handles files and locking. There is one bug fix in here -
build.write_cache() was using os.rename to replace a file, which
fails on Windows. I was only able to fix that for Python 3.3 and up.
(The goal is to avoid having to mark up tests just because they need
this kind of translation.)
@gvanrossum gvanrossum merged commit a4e36e8 into master Jun 6, 2016
@gvanrossum
Copy link
Member Author

I've just merged this so we have Windows coverage before the (still pending) 0.4.2 release.

@gvanrossum gvanrossum deleted the jtatum-appveyor branch June 6, 2016 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants