[TIP] example of Do Fixture in python
Emily.Bache at astrazeneca.com
Fri May 18 10:58:51 PDT 2007
I've just downloaded the python port of fit and FitLibrary, and I'm trying to create a test using a DoFixture. I'm a beginner to FIT although I have read Rick's book. I followed Grig's tutorial at http://agiletesting.blogspot.com/2004/11/writing-fitnesse-tests-in-python.html to the point where I had the "Division" example running, then I made a small modification in the code to change it to be a DoFixture. I realize I will need to make more changes than this, but I can't find any examples so I'm rather feeling my way. So the code is now:
from fit.ColumnFixture import ColumnFixture
from fitLib import DoFixture
numerator = 0.0
denominator = 0.0
return self.numerator / self.denominator
This produces a stack trace when I run it in fitnesse:
Traceback (most recent call last): File "C:\Python24\Lib\site-packages\fit\fit\Fixture.py", line 166, in doTables fixture = self.getLinkedFixtureWithArgs(tables) File "C:\Python24\Lib\site-packages\fit\fit\Fixture.py", line 208, in getLinkedFixtureWithArgs fixture = self.loadFixture(header)() File "C:\Python24\Lib\site-packages\fit\fit\Fixture.py", line 113, in loadFixture shouldBeAFixture) File "C:\Python24\Lib\site-packages\fit\fit\FixtureLoader.py", line 65, in loadFixture shouldBeAFixture) File "C:\Python24\Lib\site-packages\fit\fit\FixtureLoader.py", line 82, in _loadModuleIsLastElement theClass = self._doLoad(parts, pathToModule, className) File "C:\Python24\Lib\site-packages\fit\fit\FixtureLoader.py", line 90, in _doLoad result = __import__(pathToModule) File "C:\dojo\Division.py", line 4, in ? class Division(DoFixture): TypeError: Error when calling the metaclass bases module.__init__() takes at most 2 arguments (3 given)
I am mystified since this stack trace seems to be telling me my constructor is being passed too many arguments. Where are these arguments coming from?
If anyone could provide a working example of a DoFixture in python I would appreciate it.
More information about the testing-in-python