@FileSystem.in_directory(current_directory, 'django', 'alfaces')
def test_django_background_server_running_in_background():
 import tornado.ioloop
 import tornado.web
 class MainHandler(tornado.web.RequestHandler, ):
  def get(self):
   self.write('Hello, world')
   raise SystemExit()
 def runserver():
  application = tornado.web.Application([('/', MainHandler)])
  application.listen(8000)
  tornado.ioloop.IOLoop.instance().start()
 server = multiprocessing.Process(target=runserver)
 server.start()
 time.sleep(1)
 e = 'Lettuce could not run the builtin Django server at 0.0.0.0:8000"\nmaybe you forgot a "runserver" instance running ?\n\nwell if you really do not want lettuce to run the server for you, then just run:\n\npython manage.py --no-server'
 try:
  (status, out) = commands.getstatusoutput('python manage.py harvest --verbosity=3 --no-color')
  assert_equals(out, e)
  assert_not_equals(status, 0)
 finally:
  os.kill(server.pid, 9)

@ FileSystem . in_directory ( current_directory , 'django' , 'alfaces' ) def test_django_background_server_running_in_background ( ) : import tornado . ioloop import tornado . web class MainHandler ( tornado . web . RequestHandler , ) : def get ( self ) : self . write ( 'Hello, world' ) raise SystemExit ( ) def runserver ( ) : application = tornado . web . Application ( [ ( '/' , MainHandler ) ] ) application . listen ( 8000 ) tornado . ioloop . IOLoop . instance ( ) . start ( ) server = multiprocessing . Process ( target = runserver ) server . start ( ) time . sleep ( 1 ) e = 'Lettuce could not run the builtin Django server at 0.0.0.0:8000"\nmaybe you forgot a "runserver" instance running ?\n\nwell if you really do not want lettuce to run the server for you, then just run:\n\npython manage.py --no-server' try : ( status , out ) = commands . getstatusoutput ( 'python manage.py harvest --verbosity=3 --no-color' ) assert_equals ( out , e ) assert_not_equals ( status , 0 ) finally : os . kill ( server . pid , 9 )
the django builtin server fails if the http port is not available .