[Windmill-dev] Newbie mistake - don't name your tests folder
'windmill'! :-P
Sam Minnee
sam at silverstripe.com
Mon Jan 14 20:06:35 PST 2008
Hi all,
I thought I would just flag a newbie mistake here. I'm coming to
windmill with very little python experience so this might seem obvious
to you but wasn't to me!
I started writing tests, and put them into a folder called myapp/tests/
windmill
Everything seemed to work until I tried to run tests using functest.
I was trying to execute my tests like so:
cd myapp/test/windmill
functest browser=firefox url=http://localhost/samdev/admin
I couldn't figure out why "from windmill.authoring import
setup_module, teardown_module, enable_collector" didn't work.
I kept getting an "ImportError: No module named authoring" error.
It turns out that python was placing a bit more importance on my
folder name than I want it to. It was trying to find the authoring
module in myapp/tests/windmill/authoring! :-P
So - your test folder can't be called windmill. Renaming it to myapp/
tests/windmill_tests fixed everything. Now I can run my tests using
functest:
$ functest browser=firefox url=http://localhost/samdev/admin
windmill_tests.setup_module() .
windmill_tests.tests: .
windmill_tests.teardown_module() .
-------------------------------------
windmill.browser.firefox: INFO ['/Applications/Firefox.app/
Contents/MacOS/firefox-bin', '-profile', '/var/folders/mF/
mFD264zNF6KNHW+kIG6a5k+++TI/-Tmp-/tmpWOTiUX.windmill', 'http://localhost/samdev/admin/windmill-serv/start.html'
]
Passed: 3, Failed: 0, Skipped: 0
There were a couple of other things that weren't documented:
* It wasn't clear is the need to call enable_collector() from
__init__.py. I added a note about this to the wiki here: http://windmill.osafoundation.org/trac/wiki/BookChapter-5-RunningTests?action=diff&version=23
* The use of functest to call windmill tests isn't really documented
anywhere
More information about the Windmill-dev
mailing list