[Windmill-dev] Re: Status of django-windmill integration
Mikeal Rogers
mikeal at osafoundation.org
Sat Nov 3 19:36:33 PDT 2007
Windmill doesn't use unittest, it uses functest ( http://functest.pythonesque.org
) so getting a live server up and tearing it down for a certain
series of tests is much easier.
I've done functest integration with a live django server for a
personal project that lives outside of the normal django test system.
All i did was define a setup_module and teardown_module in a new base
"test" module that sets up my django project in a pure python wsgi
server (I'm using cherrypy because I'm comfortable with it but you
could just as easily use the server in wsgiref ). From there I have
sub modules that test against the live server, some of these could
easily be windmill python tests -- the django project I'm working on
just isn't at the point where i need them yet.
The catch right now is that json and js windmill tests won't run in
this framework. My number one windmill task right now is to add a more
modularized collector system to functest that will allow windmill to
define a new dynamic collector that will bring in json and js tests.
Once that is done I'll add some documentation on our wiki and windmill
will start "officially" supporting a django-windmill integration path.
The new collector work in functest should allow it to dynamically
collect and translate unittest.TestCase tests and doctest tests to
functest tests and run them. With that it's conceivable that functest
could be integrated in to django ( just like how windmill integrates
functest ) and replace the current test framework -- but I'll only be
doing that work if it sounds like the django community would like to
have it. Regardless, windmill will support a django testing scenario
outside of code that lives inside the django project.
Here is the setup and teardown I'm using in another project so that
functest brings up and tears down a live server with my django project.
# Copyright (c) 2007 Mikeal Rogers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys, os
from time import sleep
def setup_module(module):
sys
.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir, os.path.pardir, os.path.pardir)))
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
_application = django.core.handlers.wsgi.WSGIHandler()
def application(environ, start_response):
environ['PATH_INFO'] = environ['SCRIPT_NAME'] +
environ['PATH_INFO']
return _application(environ, start_response)
import cherrypy
httpd = cherrypy.wsgiserver.CherryPyWSGIServer(('', 7887),
application, server_name='mysite-http')
from threading import Thread
httpd_thread = Thread(target=httpd.start)
httpd_thread.start()
sleep(.5)
module.httpd_thread = httpd_thread
module.httpd = httpd
def teardown_module(module):
module.httpd.stop()
-Mikeal
On Nov 3, 2007, at 3:44 PM, <bugs at almad.net> <bugs at almad.net> wrote:
>
> Hello,
>
> because of Your response to django ticket #2879 (http://code.djangoproject.com/ticket/2879
> ) I'd like to ask if there is any progress on django-windmill
> integration.
>
> I'm satisfied with both Selenium and Windmill, but I'd like to ask
> how have you solved problem described in this ticket - even if
> browser is started via one of those frameworks, django is not
> providing real server to test it against.
>
> Thanks,
>
> Lukas "Almad" Linhart
>
More information about the Windmill-dev
mailing list