-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Tests do not work under Windows #51
Comments
@MartinJohns I can't easily test this, but can you try the following hack to see if it makes things work for you? diff --git a/runtest.py b/runtest.py
index 436b769..c9d2ea8 100755
--- a/runtest.py
+++ b/runtest.py
@@ -12,9 +12,12 @@ import pty, array, fcntl, termios
IS_PY_3 = sys.version_info[0] == 3
-# TODO: do we need to support '\n' too
-sep = "\r\n"
-#sep = "\n"
+import platform
+if platform.system().find("CYGWIN_NT") >= 0:
+ # TODO: this is weird, is this really right on Cygwin?
+ sep = "\n\r\n"
+else:
+ sep = "\r\n"
rundir = None
parser = argparse.ArgumentParser( |
@MartinJohns had a chance to test the above change? |
@kanaka This patch (off master) works on Cygwin 64 (and probably 32, but I
|
The I tried manually changing the |
The unrelated reason seems to be that Python for Windows doesn't include the This one-liner will pass the step0 test using Cygwin's while 1:print raw_input("user> ") This still does not work when using Python for Windows:
Cygwin's while 1:print(input("user> ")) But and Windows'
This time it does appear to be an issue with line terminators, but changing back to |
I got tests working on Windows Under Cygwin64 withe following couple of changes. (This is a diff from Master) @@ -125,11 +125,11 @@ class Runner():
debug(new_data)
if self.no_pty:
self.buf += new_data.replace("\n", "\r\n")
else:
self.buf += new_data
- self.buf = self.buf.replace("\r\r", "\r")
+ self.buf = self.buf.replace("\r\r", sep)
for prompt in prompts:
regexp = re.compile(prompt)
match = regexp.search(self.buf)
if match:
end = match.end()
@@ -191,17 +191,18 @@ class TestReader:
return True
continue
elif line[0:1] == ";": # unexpected comment
log("Test data error at line %d:\n%s" % (self.line_num, line))
return None
- self.form = line # the line is a form to send
+ # remove the last character. Writeline will insert the line ending.
+ self.form = line[0:len(line)-1] # the line is a form to send
# Now find the output and return value
while self.data:
line = self.data[0]
if line[0:3] == ";=>":
- self.ret = line[3:]
+ self.ret = line[3:].rstrip() + sep
self.line_num += 1
self.data.pop(0)
break
elif line[0:2] == "; ":
self.out = self.out + line[2:] + sep I think part of the problem, as stated above, is that when the repo is clones with Git on Windows, the line endings are changed to \r\n. Adding the conditional |
@nukecoder that patch breaks tests on Linux. If somebody suggests a clean patch that will work on Linux, OS X and Windows (cygwin or native but both would be a plus) I'll be happy to merge it. I don't have a convenient way to test all three (only Linux). |
According to @nukecoder 's message another thing we should pay attention to is Git's translation of line endings - apparently on Windows git will auto-translate line endings to |
It seems like cygwin version
Tested (passed all tests): |
Okay, seems like this has been resolved and tested by @inkydragon in #396 (thanks!) so I'm going to close it. |
I'm trying to run the unit tests for step 0 under Windows, using cygwin. But there seems to be an issue with the line endings. I'm doing what is described in step 0 - I write the prompt, read the input, write the input out and repeat.
Here's the output of the test call:
Got any idea on how to solve this?
The text was updated successfully, but these errors were encountered: