K9Qc@sWddlZddlZddlZddlZddlZddlZddlmZddlmZm Z ddl m Z ddl m Z ejeZddgZdd gZd d fZd efd YZdefdYZdefdYZdefdYZdefdYZdZdZdZdZdS(iN(t OptionParser(tabsdirttolist(t NoPlugins(twarnthelptverboses ~/.nosercs ~/nose.cfgtwin32tclitNoSuchOptionErrorcBseZdZRS(cCstj||||_dS(N(t Exceptiont__init__tname(tselfR ((s//sys/lib/python2.7/site-packages/nose/config.pyR s(t__name__t __module__R (((s//sys/lib/python2.7/site-packages/nose/config.pyR st ConfigErrorcBseZRS((RR(((s//sys/lib/python2.7/site-packages/nose/config.pyR#stConfiguredDefaultsOptionParsercBs\eZdZd d dZdZdZdZdZdZ dZ dZ RS( s@ Handler for options from commandline and config files. csa||_||_dkr-|jjn|_|dkrTfd}n||_dS(Ncs |S(N((tmsgtkw(terror(s//sys/lib/python2.7/site-packages/nose/config.pyt2s(t_parsert_config_sectiontNoneRt_errort _file_error(R tparsertconfig_sectionRt file_error((Rs//sys/lib/python2.7/site-packages/nose/config.pyR +s     cCs[g}|j|jkrWx9|j|jD]"\}}|j|||fq.Wn|S(N(Rtsectionstitemstappend(R tcfgtfilenametconfigR tvalue((s//sys/lib/python2.7/site-packages/nose/config.pyt _configTuples5s cCsg}xy|D]q}tj}y|j|Wn2tjk rd}td|t|fnX|j|j||q W|S(Ns Error reading config file %r: %s(t ConfigParsertRawConfigParsertreadtErrorRtstrtextendR%(R t filenamesR#R"R!texc((s//sys/lib/python2.7/site-packages/nose/config.pyt_readFromFilenames<s  cCstj}y |j}Wntk r2d}nXy|j|Wn2tjk rx}td|t|fnX|j||S(Nss Error reading config file %r: %s( R&R'R tAttributeErrortreadfpR)RR*R%(R tfhR!R"R-((s//sys/lib/python2.7/site-packages/nose/config.pyt_readFromFileObjectHs    cCsny |jWnGtk rT|}t|tr<|g}n|}|j|}nX|}|j|}|S(N(treadlineR/t isinstancet basestringR.R2(R t config_filestfilename_or_filenamesR,R#R1((s//sys/lib/python2.7/site-packages/nose/config.pyt_readConfigurationUs   cCsNd|}|j|}|dkr4t|n|j||||dS(Ns--(t get_optionRR tprocess(R R R$tvaluesRtopt_strtoption((s//sys/lib/python2.7/site-packages/nose/config.pyt_processConfigValueds   c Csx|D]\}}}|tkr(qny|j||||Wqtk r}}|jd||jfd|d|qtjk r}t|jd|t |d}|jd||fd|d|qXqWdS(Ns/Error reading config file %r: no such option %rR R"s--is Error reading config file %r: %s( toption_blacklistR>R RR toptparsetOptionValueErrorR*treplacetrepr( R RR#R;R R$R"R-R((s//sys/lib/python2.7/site-packages/nose/config.pyt_applyConfigurationToValuesls %  cCs|jj}y|j|}Wn&tk rJ}|jt|nDXy|j|j||Wn&tk r}|jt|nX|jj||S(N(Rtget_default_valuesR8RRR*RDt parse_args(R targsR6R;R#R-((s//sys/lib/python2.7/site-packages/nose/config.pytparseArgsAndConfigFiles}sN( RRt__doc__RR R%R.R2R8R>RDRH(((s//sys/lib/python2.7/site-packages/nose/config.pyR's    tConfigcBseZdZdZdZdZdZeZdZdddZ dZ dZ d Z dd Zdd Zd Zd ZdZdZRS(sDnose configuration. Instances of Config are used throughout nose to configure behavior, including plugin lists. Here are the default values for all config keys:: self.env = env = kw.pop('env', {}) self.args = () self.testMatch = re.compile(r'(?:^|[\b_\.%s-])[Tt]est' % os.sep) self.addPaths = not env.get('NOSE_NOPATH', False) self.configSection = 'nosetests' self.debug = env.get('NOSE_DEBUG') self.debugLog = env.get('NOSE_DEBUG_LOG') self.exclude = None self.getTestCaseNamesCompat = False self.includeExe = env.get('NOSE_INCLUDE_EXE', sys.platform in exe_allowed_platforms) self.ignoreFiles = (re.compile(r'^\.'), re.compile(r'^_'), re.compile(r'^setup\.py$') ) self.include = None self.loggingConfig = None self.logStream = sys.stderr self.options = NoOptions() self.parser = None self.plugins = NoPlugins() self.srcDirs = ('lib', 'src') self.runOnInit = True self.stopOnError = env.get('NOSE_STOP', False) self.stream = sys.stderr self.testNames = () self.verbosity = int(env.get('NOSE_VERBOSE', 1)) self.where = () self.py3where = () self.workingDir = None cKs|jdi|_}d|_|jddtj|_tj|j|_ |jdt  |_ d|_ |jd|_ |jd|_d|_t |_|jdtjtk|_d d d g|_ttj|j|_d|_d|_tj|_t|_d|_t |_!d|_"t#|_$|jdt |_%tj|_&g|_'t(|jdd|_)d|_*d|_+tj,|_-t |_.t |_/t0|_1t |_2|j3j4|_5|j6||j3j4|_7dS(NtenvtNOSE_TESTMATCHs(?:^|[\b_\.%s-])[Tt]estt NOSE_NOPATHt nosetestst NOSE_DEBUGtNOSE_DEBUG_LOGtNOSE_INCLUDE_EXEs^\.s^_s ^setup\.py$tlibtsrct NOSE_STOPt NOSE_VERBOSEi((slibssrc(((8tpopRKRGtgettostsept testMatchPattretcompilet testMatchtFalsetaddPathst configSectiontdebugtdebugLogRtexcludetgetTestCaseNamesCompattsystplatformtexe_allowed_platformst includeExetignoreFilesDefaultStringstmapt ignoreFilestincludet loggingConfigtstderrt logStreamt NoOptionstoptionsRRtpluginstsrcDirstTruet runOnInitt stopOnErrortstreamt testNamestintt verbositytwheretpy3wheretgetcwdt workingDirttraverseNamespacetfirstPackageWinsRt parserClasstworkert__dict__tcopyt_defaulttupdatet_orig(R RRK((s//sys/lib/python2.7/site-packages/nose/config.pyR sN                        cCsF|jj}|d=|d=|d=|d=|d=|jj|d<|S(NRwRRRKRoRr(RRRrt __class__(R tstate((s//sys/lib/python2.7/site-packages/nose/config.pyt __getstate__scCsw|jd}|j|t|_||_|jj|j}|jj|i|jj|j |dS(NRr( RVRRtRRrt loadPluginsRt addOptionst configureRq(R Rt pluginclst dummy_parser((s//sys/lib/python2.7/site-packages/nose/config.pyt __setstate__s     cCs|jj}i|dddd|j dd?dd@|jdAdBddCddd|j dd?ddD|jdEdFdd"ddGdd3ddH|jdIdJdd"ddKdd3ddL|jdMdNdd"ddOdd3ddP|jdQdRddddSd|j ddT|jdUdVddWddXd|j ddY|jdZdddd[d|j dd\|jd]ddWdd[dd^|jd_ddd|jdd`dda|jdbdcdddddtddeddf|jdgddWdtddhddi|jj|j|||_|S(ks,Get the command line option parser. s-Vs --versiontactiont store_truetdesttversionRRsOutput nose version and exits-ps --pluginsRs[Output list of available plugins and exit. Combine with higher verbosity for greater details-vs --verbosetcountRzsBe more verbose. [NOSE_VERBOSE]s --verbositytstoretmetavart VERBOSITYRRys.Set verbosity; --verbosity=2 is the same as -vs-qs--quiett store_consttconstisBe less verboses-cs--configR RtFILESsLoad configuration from config file(s). May be specified multiple times; in that case, all config files will be loaded and combineds-ws--whereR{tWHEREsLook for tests in this directory. May be specified multiple times. The first directory passed will be used as the working directory, in place of the current working directory, which is the default. Others will be added to the list of tests to execute. [NOSE_WHERE]s --py3whereR|tPY3WHEREs-Look for tests in this directory under Python 3.x. Functions the same as 'where', but only applies if running under Python 3.x or above. Note that, if present under 3.x, this option completely replaces any directories specified with 'where', so the 'where' option becomes ineffective. [NOSE_PY3WHERE]s-ms--matchs --testmatchR]tREGEXsFiles, directories, function names, and class names that match this regular expression are considered tests. Default: %s [NOSE_TESTMATCH]s--testsRxtNAMESsRun these tests (comma-separated list). This argument is useful mainly from configuration files; on the command line, just pass the tests to run as additional arguments with no switch.s-ls--debugRasActivate debug logging for one or more systems. Available debug loggers: nose, nose.importer, nose.inspector, nose.plugins, nose.result and nose.selector. Separate multiple names with a comma.s --debug-logRbtFILEs5Log debug messages to this file (default: sys.stderr)s--logging-configs --log-configRmsQLoad logging config from this file -- bypasses all other logging config settings.s-Is--ignore-filesRksCompletely ignore any file that matches this regular expression. Takes precedence over any other settings or plugins. Specifying this option will replace the default setting. Specify this option multiple times to add more regular expressions [NOSE_IGNORE_FILES]s-es --excludeRcs<Don't run tests that match regular expression [NOSE_EXCLUDE]s-is --includeRlsThis regular expression will be applied to files, directories, function names, and class names for a chance to include additional tests that do not match TESTMATCH. Specify this option multiple times to add more regular expressions [NOSE_INCLUDE]s-xs--stopRvs3Stop running tests after the first error or failures-Ps--no-path-adjustmentt store_falseR_sCDon't make any changes to sys.path when loading tests [NOSE_NOPATH]s--exeRhsLook for tests in python modules that are executable. Normal behavior is to exclude executable modules, since they may not be import-safe [NOSE_INCLUDE_EXE]s--noexesoDO NOT look for tests in python modules that are executable. (The default on the windows platform is to do so.)s--traverse-namespaceRs8Traverse through all path entries of a namespace packages--first-package-winss--first-pkg-winss--1st-pkg-winsRsnose's importer will normally evict a package from sys.modules if it sees a package with the same name in a different location. Set this option to disable that behavior.s--no-byte-compileRsiPrevent nose from byte-compiling the source into .pyc files while nose is scanning for and running tests.N(RRKRt add_optionR^RzRZRRaRbRmRvR_RhRRtRrRt pluginOpts(R RRKR((s//sys/lib/python2.7/site-packages/nose/config.pyRs                     cCs|j|jS(s*Return the generated help message (Rt format_help(R R((s//sys/lib/python2.7/site-packages/nose/config.pyRQscCs|jj||jdS(N(RrRRK(R R((s//sys/lib/python2.7/site-packages/nose/config.pyRVscCs|jj|jdS(N(RRR(R ((s//sys/lib/python2.7/site-packages/nose/config.pytresetYscCs |jjS(N(RR(R ((s//sys/lib/python2.7/site-packages/nose/config.pyttodict\scCs|jj|dS(N(RR(R R((s//sys/lib/python2.7/site-packages/nose/config.pyR_sN(RRRIR RRRt__str__RRRRRRRRRRRR(((s//sys/lib/python2.7/site-packages/nose/config.pyRJs"% +  N ;      RpcBs;eZdZdZdZdZdZdZRS(s9Options container that returns None for all options. cCsiS(N((R ((s//sys/lib/python2.7/site-packages/nose/config.pyRfscCsdS(N((R R((s//sys/lib/python2.7/site-packages/nose/config.pyRiscCsdS(N(((R ((s//sys/lib/python2.7/site-packages/nose/config.pyt__getnewargs__lscCsdS(N(R(R tattr((s//sys/lib/python2.7/site-packages/nose/config.pyt __getattr__oscCstS(N(R^(R ((s//sys/lib/python2.7/site-packages/nose/config.pyt __nonzero__rs(RRRIRRRRR(((s//sys/lib/python2.7/site-packages/nose/config.pyRpcs     cCs"ttjjttjjtS(s2Return path to any existing user config files (tfilterRXRRRjt expanduserR6(((s//sys/lib/python2.7/site-packages/nose/config.pytuser_config_filesvs cCs*t}tjjdr&|dgS|S(slReturn path to any existing user config files, plus any setup.cfg in the current working directory. s setup.cfg(RRXRR(tuser((s//sys/lib/python2.7/site-packages/nose/config.pytall_config_files}s  c CsR|dkrtS|dkr tSt|}t|dkrBtS|jd kS( s(Does the value look like an on/off flag?iiit1t0tFtTtTRUEtFALSEtONtOFF(RRRRRRRR(RtR^R*tlentupper(tval((s//sys/lib/python2.7/site-packages/nose/config.pytflags   cCst|jdkS(NRRRR(RRsTRUEsON(R*R(R((s//sys/lib/python2.7/site-packages/nose/config.pyt_bools(RR@RXR[ReR&Rt nose.utilRRtnose.plugins.managerRtwarningsRRRRR?R6RgR R RtobjectRRJRpRRRR(((s//sys/lib/python2.7/site-packages/nose/config.pyts0         d