Skip to content

Commit

Permalink
Group support features in vaurien.tests.support
Browse files Browse the repository at this point in the history
Lower a bit the time.sleep() times.
  • Loading branch information
almet committed Nov 15, 2012
1 parent f550d2e commit fc1b979
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
8 changes: 8 additions & 0 deletions vaurien/tests/support.py
@@ -1,4 +1,5 @@
import sys
import subprocess

from vaurien.webserver import create_app

Expand Down Expand Up @@ -36,5 +37,12 @@ def start_vaurien_httpserver(port):
server.serve_forever()


def start_simplehttp_server(port=8888):
cmd = [sys.executable, '-m', 'SimpleHTTPServer', str(port)]
server = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
return server


if __name__ == '__main__':
start_vaurien_httpserver(int(sys.argv[1]))
6 changes: 3 additions & 3 deletions vaurien/tests/test_http_proxy.py
Expand Up @@ -5,7 +5,7 @@

from vaurien.client import Client
from vaurien.util import start_proxy, stop_proxy
from vaurien.tests.util import start_web_server
from vaurien.tests.support import start_simplehttp_server


_PROXY = 'http://localhost:8000'
Expand All @@ -25,8 +25,8 @@ class TestHttpProxy(unittest.TestCase):
def setUp(self):
self._proxy_pid = start_proxy(options=_OPTIONS, log_level='error',
log_output='/dev/null')
self._web = start_web_server()
time.sleep(.5)
self._web = start_simplehttp_server()
time.sleep(.3)
try:
if self._web.poll():
raise ValueError("Could not start the proxy")
Expand Down
6 changes: 3 additions & 3 deletions vaurien/tests/test_proxy.py
Expand Up @@ -5,7 +5,7 @@

from vaurien.client import Client
from vaurien.util import start_proxy, stop_proxy
from vaurien.tests.util import start_web_server
from vaurien.tests.support import start_simplehttp_server


_PROXY = 'http://localhost:8000'
Expand All @@ -16,8 +16,8 @@ class TestSimpleProxy(unittest.TestCase):
def setUp(self):
self._proxy_pid = start_proxy(log_output='/dev/null',
log_level='error')
self._web = start_web_server()
time.sleep(.5)
self._web = start_simplehttp_server()
time.sleep(.2)
try:
if self._web.poll():
raise ValueError("Could not start the proxy")
Expand Down
9 changes: 0 additions & 9 deletions vaurien/tests/util.py

This file was deleted.

0 comments on commit fc1b979

Please sign in to comment.