-
Notifications
You must be signed in to change notification settings - Fork 108
adding the ability to set the host on the flask app for using a remot… #126
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -435,6 +435,7 @@ def __call__(self, result=None): | |
# Get the app | ||
self.app = self.create_app() | ||
|
||
self._configured_host = self.app.config.get('LIVESERVER_HOST', 'localhost') | ||
self._configured_port = self.app.config.get('LIVESERVER_PORT', 5000) | ||
self._port_value = multiprocessing.Value('i', self._configured_port) | ||
|
||
|
@@ -453,7 +454,7 @@ def get_server_url(self): | |
""" | ||
Return the url of the test server | ||
""" | ||
return 'http://localhost:%s' % self._port_value.value | ||
return 'http://{}:{}'.format(self._configured_host, self._port_value.value) | ||
|
||
def _spawn_live_server(self): | ||
self._process = None | ||
|
@@ -477,7 +478,7 @@ def socket_bind_wrapper(self): | |
return ret | ||
|
||
socketserver.TCPServer.server_bind = socket_bind_wrapper | ||
app.run(port=port, use_reloader=False) | ||
app.run(port=port, use_reloader=False, host=self._configured_host) | ||
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. Parameterize the |
||
|
||
self._process = multiprocessing.Process( | ||
target=worker, args=(self.app, self._configured_port) | ||
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. Should probably also add the parameters here:
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. And of course https://github.com/jarus/flask-testing/pull/126/files#diff-171a436f5b46787445201095ddb2db3fR463 will have to become
|
||
|
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.
To pass python2.6 testing, line should be apparently something more like