Skip to content

Conversation

@HelioGuilherme66
Copy link
Member

(from his commit: webdriver process management)

@HelioGuilherme66
Copy link
Member Author

Tested under Windows 7 Professional x64 and Python 2.7.12 32bit, selenium 2.53.6, RF 3.0
ChromeDriver 2.25.426923 - Chrome 54.0.2840.99 m - 0 failed tests
InternetExplorerDriver (32-bit) 2.53.1.0 - IE 11.0.31 - 23 failed tests
Firefox 47.0.1 - 0 failed tests
PhantomJS 2.1.1 - 21 failed tests (excluded Choose File test)

@aaltat
Copy link
Contributor

aaltat commented Nov 30, 2016

There are few minor things to fix, mostly code cleanup and following pep8. But those things are hard to comment with mobile. I will try to find time to comment the changes later. Could you raise an issue about the problem?


import socket

class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two empty lines before the class definition

while not self.stop:
self.handle_request()

class HttpEchoer(socket._fileobject):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two empty lines before the class definition


def start_http_server():
server_output = TemporaryFile()
#server_output = open("server.log", 'w+', buffering=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is commented out, where the line 51 server_output comes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is just an alternative way to keep the server logs (like Jari explained in initial code/Issue).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, need to read it from there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did read and looks OK.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But should we remove the comment then

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we should not remove the comment. We should add a comment describing that by default the output goes to a temporary file, but toggling the commented lines allows developer to keep the output.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don not like commented code, but adding the doc about the that part is good to go.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment for clarification.

# we are responding with HTTP 1.0 = we do not need content-length header
#self.send_header("Content-Length", str(fs[6]))
self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
#self.send_header("Connection", "close")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not needed, remove it

self.end_headers()
return f


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two empty lines before the class definition

@HelioGuilherme66
Copy link
Member Author

Code is PEP8 compliant now.

@pekkaklarck
Copy link
Member

Commented code makes no sense. If we think server logs are needed, we should write code like that. I think that would be fine, writing them into the same directory as other results shouldn't harm. If we want to make it configurable, we should add a command line option. I doubt it's worth the effort in this case.

@pekkaklarck
Copy link
Member

Also, the code is not PEP-8 compliant.

@pekkaklarck
Copy link
Member

I changed run_tests.py to preserve server logs in PR #710. Assuming it is merged, changes to run_tests.py in this PR aren't needed anymore.

(from his commit: webdriver process management) PEP8 Compliant. (untouch test/run_tests.py)
@aaltat
Copy link
Contributor

aaltat commented Jan 22, 2017

Also this PR does not resolve the problem in Windows. The test execution still fails with or without this PR. But I must say that it improves the situation a lot.

@HelioGuilherme66
Copy link
Member Author

This PR was valid at the time it was proposed.

@aaltat
Copy link
Contributor

aaltat commented Jan 22, 2017

It could be that this is some sort of windows problem. If I comment out the with http_server(): from run_tests.py and then run the python -m SimpleHTTPServer 7000 I face similar issues then with the current http server implementation.

Having the support for running test in windows would be really nice, but it strongly looks like that we need to look some other http server.

@HelioGuilherme66
Copy link
Member Author

Closing in favor of #748.
The send_header override was removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants