Merge remote-tracking branch 'origin/master'

This commit is contained in:
grossmj 2015-05-06 14:59:35 -06:00
commit a929dfea38
4 changed files with 13 additions and 3 deletions

View File

@ -40,7 +40,7 @@ class CrashReport:
Report crash to a third party service Report crash to a third party service
""" """
DSN = "sync+https://22979234ab4749ceabce08e6da4c1476:1432c8c7a43d410b9b5bb33f8e55b2a6@app.getsentry.com/38482" DSN = "sync+https://45147533567b4d529ca09c093758681f:12d8b456cdb34d23aba771325aa64ee6@app.getsentry.com/38482"
if hasattr(sys, "frozen"): if hasattr(sys, "frozen"):
cacert = os.path.join(os.getcwd(), "cacert.pem") cacert = os.path.join(os.getcwd(), "cacert.pem")
if os.path.isfile(cacert): if os.path.isfile(cacert):

View File

@ -140,7 +140,7 @@ class PortManager:
""" """
if end_port < start_port: if end_port < start_port:
raise Exception("Invalid port range {}-{}".format(start_port, end_port)) raise HTTPConflict(text="Invalid port range {}-{}".format(start_port, end_port))
if socket_type == "UDP": if socket_type == "UDP":
socket_type = socket.SOCK_DGRAM socket_type = socket.SOCK_DGRAM

View File

@ -152,7 +152,7 @@ class Project:
try: try:
shutil.rmtree(old_path) shutil.rmtree(old_path)
except OSError as e: except OSError as e:
raise aiohttp.web.HTTPConflict("Can't remove temporary directory {}: {}".format(old_path, e)) raise aiohttp.web.HTTPConflict(text="Can't remove temporary directory {}: {}".format(old_path, e))
@property @property
def name(self): def name(self):

View File

@ -45,3 +45,13 @@ def test_release_udp_port():
pm.reserve_udp_port(4242, project) pm.reserve_udp_port(4242, project)
pm.release_udp_port(4242, project) pm.release_udp_port(4242, project)
pm.reserve_udp_port(4242, project) pm.reserve_udp_port(4242, project)
def test_find_unused_port():
p = PortManager().find_unused_port(1000, 10000)
assert p is not None
def test_find_unused_port_invalid_range():
with pytest.raises(aiohttp.web.HTTPConflict):
p = PortManager().find_unused_port(10000, 1000)