def __init__(self):
     self.fixtureListener = TestRunnerFixtureListener(self)
     self._statsHandler = None
     FG.Environment = "FitNesse"
     FG.inFileName = ""
     conMsg.setEnvironment("TestRunner")
     Variations.returnVariation()
 def __init__(self):
     self.fixtureListener = TestRunnerFixtureListener(self)
     self._statsHandler = None
     FG.Environment = "FitNesse"
     FG.inFileName = ""
     conMsg.setEnvironment("TestRunner")
     Variations.returnVariation()
 def __init__(self):
     self.host = "localhost"
     self.port = 80
     self.fixtureListener = TablePrintingFixtureListener()
     self._renameFileName = ""
     FG.Environment = "FitNesse"
     FG.inFileName = ""
     FG.outFileName = ""
     Variations.returnVariation()
     conMsg.setEnvironment("FitServer")
Example #4
0
 def setUp(self):
     print '%s %s' % (self.id(), self.shortDescription())
     self.options = Options(["FileRunner", "+v", "foo", "bar"],
                            BatchBase.parmDict)
     self.saveFitGlobal = (FitGlobal.RunOptions, FitGlobal.Options,
                           FitGlobal.Environment)
     FitGlobal.RunOptions = self.options
     FitGlobal.Options = self.options
     FitGlobal.Environment = "Batch"
     Variations.returnVariation()
Example #5
0
 def setUp(self):
     print '%s %s' % (self.id(), self.shortDescription())
     self.options = Options(["FileRunner", "+v", "foo", "bar"],
                            BatchBase.parmDict)
     self.saveFitGlobal = (FitGlobal.RunOptions, FitGlobal.Options,
                           FitGlobal.Environment)
     FitGlobal.RunOptions = self.options
     FitGlobal.Options = self.options
     FitGlobal.Environment = "Batch"
     Variations.returnVariation()
 def __init__(self):
     self.host = "localhost"
     self.port = 80
     self.fixtureListener = TablePrintingFixtureListener()
     self._renameFileName = ""
     FG.Environment = "FitNesse"
     FG.inFileName = ""
     FG.outFileName = ""
     Variations.returnVariation()
     conMsg.setEnvironment("FitServer")
 def establishCommonTopLevelOptions(self, opts, pythonPath):
     # ??? should we avoid adding elements that are already there?
     if pythonPath:
         sys.path[1:1] = pythonPath
     FG.RunOptions = opts
     if opts.standardsLevel in ("1.1", "2.0"):
         FG.SpecificationLevel = opts.standardsLevel
     self._extractDiagnosticOptions(opts, FG.RunDiagnosticOptions)
     self._extractRunLevelSymbols(opts, FG.RunLevelSymbols)
     self._loadAppConfigurationModule(opts)
     Variations.returnVariation()
     return
 def establishCommonTopLevelOptions(self, opts, pythonPath):
     # ??? should we avoid adding elements that are already there?
     if pythonPath:
         sys.path[1:1] = pythonPath
     FG.RunOptions = opts
     if opts.standardsLevel in ("1.1", "2.0"):
         FG.SpecificationLevel = opts.standardsLevel
     self._extractDiagnosticOptions(opts, FG.RunDiagnosticOptions)
     self._extractRunLevelSymbols(opts, FG.RunLevelSymbols)
     self._loadAppConfigurationModule(opts)
     Variations.returnVariation()
     return
Example #9
0
 def setUp(self):
     print '%s %s' % (self.id(), self.shortDescription())
     self.options = Options(["FileRunner", "+v", "+e", "foo", "bar"],
                            BatchBase.parmDict)
     self.saveFitGlobal = (FitGlobal.RunOptions, FitGlobal.Options,
                           FitGlobal.Environment)
     self.saveAppExit = (FitGlobal.appConfigModule, FitGlobal.appConfig)
     FitGlobal.RunOptions = self.options
     FitGlobal.Options = self.options
     FitGlobal.Environment = "Batch"
     FitGlobal.appConfigModule = MockAppConfigMapFixture
     FitGlobal.appConfig = MockAppConfigMapFixture()
     Variations.returnVariation()
     self.obj = FixtureLoader()
     FixtureLoader.clearFixtureRenameTable()
 def setUp(self):
     print '%s %s' % (self.id(), self.shortDescription())
     self.options = Options(["FileRunner", "+v", "+e", "foo", "bar"],
                            BatchBase.parmDict)
     self.saveFitGlobal = (FitGlobal.RunOptions, FitGlobal.Options,
                           FitGlobal.Environment)
     self.saveAppExit = (FitGlobal.appConfigModule, FitGlobal.appConfig)
     FitGlobal.RunOptions = self.options
     FitGlobal.Options = self.options
     FitGlobal.Environment = "Batch"
     FitGlobal.appConfigModule = MockAppConfigMapFixture
     FitGlobal.appConfig = MockAppConfigMapFixture()
     Variations.returnVariation()
     self.obj = FixtureLoader()
     FixtureLoader.clearFixtureRenameTable()
 def setUp(self):
     print '%s %s' % (self.id(), self.shortDescription())
     self.options = Options(["FileRunner", "+v", "+e", "foo", "bar"],
                            BatchBase.parmDict)
     self.saveFitGlobal = (FitGlobal.RunOptions, FitGlobal.Options,
                           FitGlobal.Environment)
     FitGlobal.RunOptions = self.options
     FitGlobal.Options = self.options
     FitGlobal.Environment = "Batch"
     Variations.returnVariation()
     ##        it = getattr(FixtureLoader, "__it__", None)
     ##        if it is not None:
     ##            del FixtureLoader.__it__
     self.obj = FixtureLoader()
     FixtureLoader.clearFixtureRenameTable()
Example #12
0
    def setUp(self):
        print '%s %s' % (self.id(), self.shortDescription())
        self.options = Options(["FileRunner", "+v", "+e", "foo", "bar"],
                               BatchBase.parmDict)
        self.saveFitGlobal = (FitGlobal.RunOptions, FitGlobal.Options,
                              FitGlobal.Environment)
        FitGlobal.RunOptions = self.options
        FitGlobal.Options = self.options
        FitGlobal.Environment = "Batch"
        Variations.returnVariation()
##        it = getattr(FixtureLoader, "__it__", None)
##        if it is not None:
##            del FixtureLoader.__it__ 
        self.obj = FixtureLoader()
        FixtureLoader.clearFixtureRenameTable()
Example #13
0
 def testExtendedCamel(self):
     obj = Variations.VariationsBase()
     for label, identifier in [
         ("two words", "twoWords"),
         ("three wee words", "threeWeeWords"),
         ("\" hi \"", "quoteHiQuote"),
         ("!#$%age", "bangHashDollarPercentAge"),
         ("&'()*",
          "ampersandSingleQuoteLeftParenthesisRightParenthesisStar"),
         ("+,-./:", "plusCommaMinusDotSlashColon"),
         (";=?", "semicolonEqualsQuestion"),
         ("@[]\\", "atLeftSquareBracketRightSquareBracketBackslash"),
         ("^`{}~", "caretBackquoteLeftBraceRightBraceTilde"),
         ("cost $", "costDollar"),
         ("cost$", "costDollar"),
         ("!", "bang"),
         ("!!", "bangBang"),
         ("meet @", "meetAt"),
         ("*****@*****.**", "rickAtMugridgeDotCom"),
         ("", "blank"),
         ("2 words", "twoWords"),
         ("return", "return_"),
         (u"\u216C", u"u216C"),
         (u"\u216D\uFFFE", u"u216DuFFFE"),
         (u"\uFFFF", u"uFFFF"),
         (u"\u0041b", u"Ab"),
     ]:
         result = obj._extendedLabelMapping(label)
         assert result == identifier, (
             "'%s' should transform to: '%s' is: '%s'" %
             (label, identifier, result))
Example #14
0
def setupFitGlobalForTests(env, opts=[]):
    # Run Level Globals
    FG.specificationLevel = "1.1"
    FG.Environment = env
    FG.RunAppConfigModule = None
    FG.RunAppConfig = None
    FG.RunDiagnosticOptions = {}
    FG.RunLevelSymbols = {}
    if env == "Batch":
        FG.RunOptions = Options(["FileRunner", "+v"] + opts,
                                SO.BatchBase.parmDict)
    elif env == "FitNesseOnline":
        FG.RunOptions = Options(["FitServer", "+v"] + opts,
                                SO.FitServer.parmDict)
        FG.Environment = "FitNesse"
    elif env == "FitNesseBatch":
        FG.RunOptions = Options(["TestRunner", "+v"] + opts,
                                SO.TestRunner.parmDict)
        FG.Environment = "FitNesse"
    FG.FitNesseRoot = SO.OptionsBase.fitNesse_Root
    # Test Level Globals
    FG.Options = FG.RunOptions
    FG.appConfigModule = FG.RunAppConfigModule
    FG.appConfig = FG.RunAppConfig
    FG.diagnosticOptions = copy.copy(FG.RunDiagnosticOptions)
    FG.annotationStyleVariation = Variations.returnVariation(FG.Environment)
    FG.inFileName = ""
    FG.outFileName = ""
    FG.testLevelSymbols = copy.copy(FG.RunLevelSymbols)
def setupFitGlobalForTests(env, opts=[]):
    # Run Level Globals
    FG.specificationLevel = "1.1"
    FG.Environment = env
    FG.RunAppConfigModule = None
    FG.RunAppConfig = None
    FG.RunDiagnosticOptions = {}
    FG.RunLevelSymbols = {}
    if env == "Batch":
        FG.RunOptions = Options(["FileRunner", "+v"] + opts,
                                SO.BatchBase.parmDict)
    elif env == "FitNesseOnline":
        FG.RunOptions = Options(["FitServer", "+v"] + opts,
                                SO.FitServer.parmDict)
        FG.Environment = "FitNesse"
    elif env == "FitNesseBatch":
        FG.RunOptions = Options(["TestRunner", "+v"] + opts,
                                SO.TestRunner.parmDict)
        FG.Environment = "FitNesse"
    FG.FitNesseRoot = SO.OptionsBase.fitNesse_Root
    # Test Level Globals
    FG.Options = FG.RunOptions
    FG.appConfigModule = FG.RunAppConfigModule
    FG.appConfig = FG.RunAppConfig
    FG.diagnosticOptions = copy.copy(FG.RunDiagnosticOptions)
    FG.annotationStyleVariation = Variations.returnVariation(FG.Environment)
    FG.inFileName = ""
    FG.outFileName = ""
    FG.testLevelSymbols = copy.copy(FG.RunLevelSymbols)
Example #16
0
 def doTables(self, tables):
     self.listener.tablesStarted(tables)
     self.summary["run date"] = time.ctime(time.time())
     self.summary["run elapsed time"] = RunTime()
     Variations.returnVariation()
     if tables.tag.lower() == "<wiki>":
         tables = tables.parts
     # Rick's unrolled process begins here...
     if tables is not None:
         heading = self.fixtureName(tables)
         if heading is not None:
             try:
                 fixture = self.getLinkedFixtureWithArgs(tables)
                 fixture.interpretTables(tables)
             except Exception, e:
                 self.exception(heading, e)
                 self.listener.tableFinished(tables)
                 self._interpretFollowingTables(tables)
Example #17
0
 def doTables(self, tables):
     self.listener.tablesStarted(tables)
     self.summary["run date"] = time.ctime(time.time())
     self.summary["run elapsed time"] = RunTime()
     Variations.returnVariation()
     if tables.tag.lower() == "<wiki>":
         tables = tables.parts
     # Rick's unrolled process begins here...
     if tables is not None:
         heading = self.fixtureName(tables)
         if heading is not None:
             try:
                 fixture = self.getLinkedFixtureWithArgs(tables)
                 fixture.interpretTables(tables)
             except Exception, e:
                 self.exception(heading, e)
                 self.listener.tableFinished(tables)
                 self._interpretFollowingTables(tables)
Example #18
0
 def testCamel(self):
     obj = Variations.VariationsBase()
     for header, identifier in [
         ("hi there!", "hiThere"),
         ("123.45", "one2345"),
         ("pass", "pass_"),
         ("try_this", "try_this"),  #0.8a2 was tryThis
         ("Leading caps", "LeadingCaps"),
         ("One2buckle My shoe", "One2buckleMyShoe"),
     ]:
         result = obj.camel(header)
         assert result == identifier, (
             "'%s' should transform to: '%s' is: '%s'" %
             (header, identifier, result))
Example #19
0
    def parms(self, optv):
        self.options = Options(optv, BatchBase.parmDict, "BatchBase")
        # was self._parmDict
        opts = self.options
        FG.RunOptions = opts
        FG.Options = opts
        conMsg.setVerbose(opts.verbose)
        errMsgs = opts.eMsgs
        fileList = opts.posParms
        if not opts.isValid:
            for msg in errMsgs:
                conMsg.err(msg)
            self._usage()
            return False

        if opts.standardsLevel == "":
            FG.SpecificationLevel = "1.1"
        elif opts.standardsLevel != "1.1":
            conMsg.err("Standards level must be 1.1")
            FG.SpecificationLevel = "1.1"
        else:
            FG.SpecificationLevel = opts.standardsLevel

        if opts.standardMode is True:
            if opts.useCSS is True:
                conMsg.err("Standards mode requested. CSS output suppressed")
                opts.useCSS = False

        parmEditOK = ParmEditStatus()
        runType = "?"

        result = self._loadAppConfigurationModule(opts)
        if result is not True:
            conMsg.err(result)
            parmEditOK += False

        if 2 <= len(fileList) <= 3:
            self.inDir = FG.fsa.abspath(fileList[0])
            self.outDir = FG.fsa.abspath(fileList[1])
            statFile = FG.fsa.join(self.outDir, "FitStatistics.xml")
            if FG.fsa.isdir(self.inDir):
                self.inFile = None
                runType = "d"
                self._runObj = DirectoryRunner(self.inDir, self.outDir,
                                               self.options)
                if not FG.fsa.isdir(self.outDir):
                    conMsg.err(
                        "Output must be existing directory for input directory option")
                    parmEditOK += False
            elif (FG.fsa.isfile(self.inDir)):
                self.inFile = self.inDir
                self.inDir, tail = FG.fsa.split(self.inFile)
                root, ext = FG.fsa.splitext(self.inFile)
                if ext == ".txt":
                    if len(fileList) > 2:
                        conMsg.err(
                            "Rename File not allowed for list of files option")
                        parmEditOK += False
                    runType = "l"
                    self._runObj = FileListRunner(self.inFile, self.outDir,
                                                  self.options)
                    if not self.options.isValid:
                        for msg in self.options.eMsgs:
                            conMsg.err(msg)
                        self._usage()
                        return False
                        
                    parmEditOK += FG.appConfigInterface("listOfFilesOptions",
                                          self.options)
                    if not FG.fsa.isdir(self.outDir):
                        conMsg.err(
                            "Output must be existing directory for List of Files option")
                        parmEditOK += False
                else:
                    runType = "h"
                    self._runObj = HTMLRunner(self.inFile, self.outDir,
                                              self.options)
                    statFile = ""
                    head, tail = FG.fsa.split(self.outDir)
                    if not FG.fsa.isdir(head):
                        conMsg.err(
                            "Output directory for result file must exist.")
                        parmEditOK += False
                    else:
                        if FG.fsa.exists(self.outDir) and not FG.fsa.isfile(self.outDir):
                            conMsg.err(
                                "Output for single file option must be a file.")
                            parmEditOK += False
                    
            else:
                conMsg.err("'%s' does not exist!\n" % self.inDir)
                parmEditOK += False

        else:
            conMsg.err("Wrong number of positional parameters\n")
            parmEditOK += False

        # options from the "list of files" have been merged at this point
        parmEditOK += self._extractDiagnosticOptions(opts,
                                        FG.RunDiagnosticOptions)
        result = self._extractRunLevelSymbols(opts,
                                        FG.RunLevelSymbols)
        parmEditOK += result

        if len(fileList) == 3:
            loadOK = self._loadRenameFile(fileList[2])
            if not loadOK:
                conMsg.err("Rename file '%s' failed to load" % fileList[2])
            parmEditOK += loadOK
        else:
            default = FG.fsa.join(self.inDir, "FixtureRenames.txt")
            self._loadRenameFile(default)

        self.runType = runType
        Variations.returnVariation()

        if parmEditOK:
            self._setupStatisticsFile(runType, opts, statFile)
            self._setupConsoleStatisticsPrint(opts, runType)
            stack.init(opts)
            return True

        self._usage()
        return False
Example #20
0
    def parms(self, optv):
        self.options = Options(optv, BatchBase.parmDict, "BatchBase")
        # was self._parmDict
        opts = self.options
        FG.RunOptions = opts
        FG.Options = opts
        conMsg.setVerbose(opts.verbose)
        errMsgs = opts.eMsgs
        fileList = opts.posParms
        if not opts.isValid:
            for msg in errMsgs:
                conMsg.err(msg)
            self._usage()
            return False

        if opts.standardsLevel == "":
            FG.SpecificationLevel = "1.1"
        elif opts.standardsLevel != "1.1":
            conMsg.err("Standards level must be 1.1")
            FG.SpecificationLevel = "1.1"
        else:
            FG.SpecificationLevel = opts.standardsLevel

        if opts.standardMode is True:
            if opts.useCSS is True:
                conMsg.err("Standards mode requested. CSS output suppressed")
                opts.useCSS = False

        parmEditOK = ParmEditStatus()
        runType = "?"

        result = self._loadAppConfigurationModule(opts)
        if result is not True:
            conMsg.err(result)
            parmEditOK += False

        if 2 <= len(fileList) <= 3:
            self.inDir = FG.fsa.abspath(fileList[0])
            self.outDir = FG.fsa.abspath(fileList[1])
            statFile = FG.fsa.join(self.outDir, "FitStatistics.xml")
            if FG.fsa.isdir(self.inDir):
                self.inFile = None
                runType = "d"
                self._runObj = DirectoryRunner(self.inDir, self.outDir,
                                               self.options)
                if not FG.fsa.isdir(self.outDir):
                    conMsg.err(
                        "Output must be existing directory for input directory option")
                    parmEditOK += False
            elif (FG.fsa.isfile(self.inDir)):
                self.inFile = self.inDir
                self.inDir, tail = FG.fsa.split(self.inFile)
                root, ext = FG.fsa.splitext(self.inFile)
                if ext == ".txt":
                    if len(fileList) > 2:
                        conMsg.err(
                            "Rename File not allowed for list of files option")
                        parmEditOK += False
                    runType = "l"
                    self._runObj = FileListRunner(self.inFile, self.outDir,
                                                  self.options)
                    if not self.options.isValid:
                        for msg in self.options.eMsgs:
                            conMsg.err(msg)
                        self._usage()
                        return False
                        
                    parmEditOK += FG.appConfigInterface("listOfFilesOptions",
                                          self.options)
                    if not FG.fsa.isdir(self.outDir):
                        conMsg.err(
                            "Output must be existing directory for List of Files option")
                        parmEditOK += False
                else:
                    runType = "h"
                    self._runObj = HTMLRunner(self.inFile, self.outDir,
                                              self.options)
                    statFile = ""
                    head, tail = FG.fsa.split(self.outDir)
                    if not FG.fsa.isdir(head):
                        conMsg.err(
                            "Output directory for result file must exist.")
                        parmEditOK += False
                    else:
                        if FG.fsa.exists(self.outDir) and not FG.fsa.isfile(self.outDir):
                            conMsg.err(
                                "Output for single file option must be a file.")
                            parmEditOK += False
                    
            else:
                conMsg.err("'%s' does not exist!\n" % self.inDir)
                parmEditOK += False

        else:
            conMsg.err("Wrong number of positional parameters\n")
            parmEditOK += False

        # options from the "list of files" have been merged at this point
        parmEditOK += self._extractDiagnosticOptions(opts,
                                        FG.RunDiagnosticOptions)
        result = self._extractRunLevelSymbols(opts,
                                        FG.RunLevelSymbols)
        parmEditOK += result

        if len(fileList) == 3:
            loadOK = self._loadRenameFile(fileList[2])
            if not loadOK:
                conMsg.err("Rename file '%s' failed to load" % fileList[2])
            parmEditOK += loadOK
        else:
            default = FG.fsa.join(self.inDir, "FixtureRenames.txt")
            self._loadRenameFile(default)

        self.runType = runType
        Variations.returnVariation()

        if parmEditOK:
            self._setupStatisticsFile(runType, opts, statFile)
            self._setupConsoleStatisticsPrint(opts, runType)
            stack.init(opts)
            return True

        self._usage()
        return False
Example #21
0
 def setUp(self):
     print '%s %s' % (self.id(), self.shortDescription())
     setupFitGlobalForTests("Batch")
     self.obj = Variations.VariationsBase()
Example #22
0
# InitEnvironment module from Python FIT
#LegalStuff jr2005
#endLegalStuff

import copy
from fit import FitGlobal as FG
from fit import Variations
from fit.Options import Options
from fit import SiteOptions as SO

if FG.RunOptions is None:
    FG.RunOptions = Options(["FileRunner", "+v"], SO.BatchBase.parmDict)
    FG.Options = FG.RunOptions
    FG.annotationStyleVariation = Variations.returnVariation("Batch")

# following is invoked by many of the test classes in the SetUp routine.
def setupFitGlobalForTests(env, opts=[]):
    # Run Level Globals
    FG.specificationLevel = "1.1"
    FG.Environment = env
    FG.RunAppConfigModule = None
    FG.RunAppConfig = None
    FG.RunDiagnosticOptions = {}
    FG.RunLevelSymbols = {}
    if env == "Batch":
        FG.RunOptions = Options(["FileRunner", "+v"] + opts,
                                SO.BatchBase.parmDict)
    elif env == "FitNesseOnline":
        FG.RunOptions = Options(["FitServer", "+v"] + opts,
                                SO.FitServer.parmDict)
        FG.Environment = "FitNesse"
# InitEnvironment module from Python FIT
#LegalStuff jr2005
#endLegalStuff

import copy
from fit import FitGlobal as FG
from fit import Variations
from fit.Options import Options
from fit import SiteOptions as SO

if FG.RunOptions is None:
    FG.RunOptions = Options(["FileRunner", "+v"], SO.BatchBase.parmDict)
    FG.Options = FG.RunOptions
    FG.annotationStyleVariation = Variations.returnVariation("Batch")


# following is invoked by many of the test classes in the SetUp routine.
def setupFitGlobalForTests(env, opts=[]):
    # Run Level Globals
    FG.specificationLevel = "1.1"
    FG.Environment = env
    FG.RunAppConfigModule = None
    FG.RunAppConfig = None
    FG.RunDiagnosticOptions = {}
    FG.RunLevelSymbols = {}
    if env == "Batch":
        FG.RunOptions = Options(["FileRunner", "+v"] + opts,
                                SO.BatchBase.parmDict)
    elif env == "FitNesseOnline":
        FG.RunOptions = Options(["FitServer", "+v"] + opts,
                                SO.FitServer.parmDict)