Skip to content

Fixes #59: Test server uses an ephemeral port instead of binding to 8282#65

Merged
RobRuana merged 2 commits intomagfest:masterfrom
RobRuana:master
Mar 9, 2017
Merged

Fixes #59: Test server uses an ephemeral port instead of binding to 8282#65
RobRuana merged 2 commits intomagfest:masterfrom
RobRuana:master

Conversation

@RobRuana
Copy link
Copy Markdown
Contributor

@RobRuana RobRuana commented Mar 9, 2017

No description provided.

Comment thread sideboard/tests/__init__.py Outdated
# Ideally we could tell cherrypy to listen on port 0, and then inspect
# it to determine what port it's using, but cherrypy doesn't support that
# yet (other parts of cherrypy will try to use the port defined in
# 'cherrypy.server.socket_port' and end up failing on startup).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great comment! However, as a style note, anytime you have a giant comment right at the beginning of a function, it should probably be a triple-quoted docstring.

Copy link
Copy Markdown
Member

@kitsuta kitsuta left a comment

Choose a reason for hiding this comment

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

Looks good to me. :)



available_port = get_available_port()
config['cherrypy']['server.socket_port'] = available_port
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just curious, why are you updating config in two ways here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

By the time this code is executed, we'll have already populated cherrypy.config with what's in our config file, so the configuration will already be living in two places, each of which we need to update.

Copy link
Copy Markdown
Member

@kitsuta kitsuta Mar 9, 2017

Choose a reason for hiding this comment

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

I thought that might be the case. I guess we then still use that value in our ConfigObj elsewhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure of all the places it's being used, but I didn't want another developer in the future to try using it and wonder why it's not working. I wanted to make sure that config['cherrypy']['server.socket_port'] always contains the value that we'd expect (principle of least astonishment).

@EliAndrewC
Copy link
Copy Markdown
Contributor

+1 other than the one style comment about using a docstring rather than a series of repeated # one-line comments

@coveralls
Copy link
Copy Markdown

coveralls commented Mar 9, 2017

Coverage Status

Coverage remained the same at 77.308% when pulling d17d447 on RobRuana:master into 9e405b0 on magfest:master.

@coveralls
Copy link
Copy Markdown

coveralls commented Mar 9, 2017

Coverage Status

Coverage remained the same at 77.308% when pulling 4c1cab4 on RobRuana:master into 9e405b0 on magfest:master.

@RobRuana RobRuana merged commit 884ec58 into magfest:master Mar 9, 2017
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.

4 participants