Blogging Ottinger (tim)

2008-September-16

Pyfit Madness Day 3

Filed under: Angst, Programming

I’m glad to have pyfit, mostly because I’m glad to have something that works like fitnesse works. I’m not a huge fitnesse fan (it has some serious issues) but I’m a user.

However, the pyfit internals are pretty confusing to me. Today’s bit is really odd. There is a function in Variations. py called returnVariation() that takes a parameter called env. That argument is never used in the function and never passed to any other function it calls. Note that there is even a __pychecker__ trick there to turn off the syntax checker’s warning about unused parameters.

Generally the function is called and the return value is ignored. Clearly we’re dependent on side-effects here.

def returnVariation(env=None):
    __pychecker__ = \"no-argsused\"
    if FitGlobal.Environment == \"FitNesse\":
        result =  FitNesseVariation()
    elif FitGlobal.Options.standardMode:
        result =  StandardVariation()
    elif FitGlobal.Options.useCSS:
        result = FitVariation()
    else:
        result = StandardVariation()
    FitGlobal.annotationStyleVariation = result
    return result

If you drop the argument, then tests stop passing.

def returnVariation():

Even though it’s never used and never passed. Even if you drop the parameter and set env to None:

def returnVariation():
    env=None
    __pychecker__ = \"no-argsused\"
    if FitGlobal.Environment == \"FitNesse\":
        result =  FitNesseVariation()
    elif FitGlobal.Options.standardMode:
        result =  StandardVariation()
    elif FitGlobal.Options.useCSS:
        result = FitVariation()
    else:
        result = StandardVariation()
    FitGlobal.annotationStyleVariation = result
    return result

There is one place where the function is called, passing a string value as env, otherwise it is always None, and it is still never passed to any method or installed in a global/local/module variable. But it somehow causes tests to fail if you remove it.

1 Comment »

The URI to TrackBack this entry is: http://tottinge.blogsome.com/2008/09/16/pyfit-madness-day-3/trackback/

  1. I didn’t like the pyfit internals and started from scratch.
    I’ve got the basic working (chapter 3 fitbook examples)
    Looking for help.

    message outlining goals

    Comment by Eddy Pronk — 2008-October-20 @ 02:26

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Get free blog up and running in minutes with Blogsome
Theme designed by Jay of onefinejay.com