Skip to content
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

fix mac installation issues #11

Merged
merged 5 commits into from
Aug 14, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix test running for OS X 10.8
It used to work on OS X 10.7, but in 10.8 splash requires
more time to start and this makes all tests fail.
  • Loading branch information
kmike committed Aug 13, 2013
commit d85b6956f4671e22d002315a0503d1254440c321
11 changes: 11 additions & 0 deletions splash/tests/test_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
from PIL import Image
from splash.tests.utils import TestServers

class TestTestUtils(unittest.TestCase):

def test_mockserver_works(self):
r = requests.get('http://localhost:8998/jsrender')
self.assertEqual(r.status_code, 200)

def test_splashserver_works(self):
r = requests.get('http://localhost:8050/debug')
self.assertEqual(r.status_code, 200)


class _RenderTest(unittest.TestCase):

host = "localhost:8050"
Expand Down
5 changes: 5 additions & 0 deletions splash/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ def __enter__(self):
msg = "unable to start splash server. error code: %d - stderr follows: \n%s" % \
(self.proc.returncode, self.proc.stderr.read())
raise RuntimeError(msg)

# wait until server starts writing debug messages,
# then wait a bit more to make it more likely to be online
self.proc.stderr.readline()
time.sleep(0.2)

def __exit__(self, exc_type, exc_value, traceback):
self.proc.kill()
Expand All @@ -35,6 +39,7 @@ def __enter__(self):
self.proc = Popen([sys.executable, '-u', '-m', 'splash.tests.mockserver'],
stdout=PIPE, env=get_testenv())
self.proc.stdout.readline()
time.sleep(0.1)

def __exit__(self, exc_type, exc_value, traceback):
self.proc.kill()
Expand Down