Skip to content

Commit

Permalink
making the functional tests a bit more permissive
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielfalcao committed Dec 14, 2015
1 parent c20ae4b commit 40a7800
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ unit: prepare lint

functional: prepare
@echo "Running functional tests ..."
@nosetests --rednose -x --with-randomly --with-coverage --cover-package=httpretty -s tests/functional
@nosetests --rednose -x --with-coverage --cover-package=httpretty -s tests/functional

acceptance: prepare
@echo "Running documentation tests tests ..."
Expand Down
13 changes: 7 additions & 6 deletions tests/functional/testserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from httpretty import HTTPretty
from httpretty.core import old_socket as true_socket

from multiprocessing import Process

Expand All @@ -61,8 +62,6 @@ def utf8(s):

return byte_type(s)

true_socket = socket.socket

PY3 = sys.version_info[0] == 3

if not PY3:
Expand Down Expand Up @@ -94,22 +93,24 @@ def get_handlers(cls):
])

def start(self):
HTTPretty.disable()

def go(app, port, data={}):
from httpretty import HTTPretty
HTTPretty.disable()

http = HTTPServer(app)
HTTPretty.disable()

http.listen(int(port))
IOLoop.instance().start()

app = self.get_handlers()

data = {}
args = (app, self.port, data)
HTTPretty.disable()
self.process = Process(target=go, args=args)
self.process.start()
time.sleep(0.4)
time.sleep(1)

def stop(self):
try:
Expand Down Expand Up @@ -145,7 +146,7 @@ def go(port):
args = [self.port]
self.process = Process(target=go, args=args)
self.process.start()
time.sleep(0.4)
time.sleep(1)

def stop(self):
try:
Expand Down

0 comments on commit 40a7800

Please sign in to comment.