Archive for the ‘ironpython’ Category

IronPython and PyFit PYTHONPATH Ordering

Thursday, June 19th, 2008

Lately I have been working on implementing an acceptance testing stack using the following:

I wasn’t the first person to try PyFit on IronPython and based on this suggestion we have switched from vanilla Iron Python to the Iron Python Community Edition for its almost out of the box compatibility with PyFit.

Anyway I ran into the following ERROR when using PyFit with Iron Python. Preparing a test runner as so:


Environment
IRONPYTHONPATH=c:\tools\pyfit\fit

import sys
import fepy
fepy.install_option('ast')
from fitnesse.FitServerImplementation import TestRunner

Causes the FitServerImplementation not to be found:


FitNesse cannot be started...
Port 80 is already in use.
Use the -p command line argument to use a different port.
Traceback (most recent call last):
File test_runner.py, line 4, in Initialize
File , line 0, in __import__##4
ImportError: No module named FitServerImplementation

This is unexpected because I am not trying to launch FitNesse and PyFit is on the IRONPYTHONPATH. What I discovered was that instead of using the IRONPYTHONPATH which essentially appends PyFit inserting PyFit at the beginning results in a correct PyFit resolution.


IRONPYTHONPATH= #No PyFit Reference

import sys
import fepy

fepy.install_option('ast')
fitpath = "PathTo/PyFIT/fit"
sys.path.insert(0, fitpath)

from fitnesse.FitServerImplementation import TestRunner

Now the TestRunner (or whatever PyFit class be it a fixture, runner, etc) is found. I am not sure why this is the case (my ignorance of python / iron python doesn’t hep) and would appreciate any insights.