Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/nose/config.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�9�c@sWddlZddlZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZddlm
Z
eje�ZddgZdd	gZd
dfZdefd
��YZdefd��YZdefd��YZdefd��YZdefd��YZd�Zd�Zd�Zd�ZdS(i�N(tOptionParser(tabsdirttolist(t	NoPlugins(twarnthelptverboses	~/.nosercs
~/nose.cfgtwin32tclitNoSuchOptionErrorcBseZd�ZRS(cCstj||�||_dS(N(t	Exceptiont__init__tname(tselfR((s//sys/lib/python2.7/site-packages/nose/config.pyRs(t__name__t
__module__R(((s//sys/lib/python2.7/site-packages/nose/config.pyR	stConfigErrorcBseZRS((RR(((s//sys/lib/python2.7/site-packages/nose/config.pyR#stConfiguredDefaultsOptionParsercBs\eZdZd	d	d�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�ZRS(
s@
    Handler for options from commandline and config files.
    csa||_||_�dkr-|jj�n�|_|dkrT�fd�}n||_dS(Ncs
�|�S(N((tmsgtkw(terror(s//sys/lib/python2.7/site-packages/nose/config.pyt<lambda>2s(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|j�krWx9|j|j�D]"\}}|j|||f�q.Wn|S(N(Rtsectionstitemstappend(R
tcfgtfilenametconfigRtvalue((s//sys/lib/python2.7/site-packages/nose/config.pyt
_configTuples5s
cCs�g}xy|D]q}tj�}y|j|�Wn2tjk
rd}td|t|�f��nX|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
cCs�tj�}y
|j}Wntk
r2d}nXy|j|�Wn2tjk
rx}td|t|�f��nX|j||�S(Ns<???>s 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|t�r<|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	Cs�x�|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__RRR%R.R2R8R>RDRH(((s//sys/lib/python2.7/site-packages/nose/config.pyR's
			
			tConfigcBs�eZdZd�Zd�Zd�Zd�ZeZd�Zddd�Z
d�Zd�Zd	�Z
dd
�Zdd�Zd�Zd
�Zd�Zd�ZRS(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
dg|_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]esttNOSE_NOPATHt	nosetestst
NOSE_DEBUGtNOSE_DEBUG_LOGtNOSE_INCLUDE_EXEs^\.s^_s^setup\.py$tlibtsrct	NOSE_STOPtNOSE_VERBOSEi((slibssrc(((8tpopRKRGtgettostsepttestMatchPattretcompilet	testMatchtFalsetaddPathst
configSectiontdebugtdebugLogRtexcludetgetTestCaseNamesCompattsystplatformtexe_allowed_platformst
includeExetignoreFilesDefaultStringstmaptignoreFilestincludet
loggingConfigtstderrt	logStreamt	NoOptionstoptionsRRtpluginstsrcDirstTruet	runOnInittstopOnErrortstreamt	testNamestintt	verbositytwheretpy3wheretgetcwdt
workingDirttraverseNamespacetfirstPackageWinsRtparserClasstworkert__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(NRwR�R�RKRoRr(R�R�Rrt	__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(
RVR�RtR�RrtloadPluginsR�t
addOptionst	configureRq(R
R�t	pluginclstdummy_parser((s//sys/lib/python2.7/site-packages/nose/config.pyt__setstate__�s
	
cCs�|jj�}i|d<g|j�D]}|jd�s&|^q&}|j�ddjg|D]}d|||f^qa�S(NRKt_s
Config(%s)s, s%s=%r(R�R�tkeyst
startswithtsorttjoin(R
tdtkR�((s//sys/lib/python2.7/site-packages/nose/config.pyt__repr__�s

csGdd�fd�}t�j��jd|�}|j|d|�S(NcsTt�jd�rD�jj|�rDd||f}t|t�nt|��dS(NtexcludedOptionsDOption %r in config file %r ignored: excluded by runtime environment(thasattrRrR�RtRuntimeWarningR(RRR"(R
(s//sys/lib/python2.7/site-packages/nose/config.pytwarn_sometimess
Ri(RRt	getParserR`RH(R
targvt	cfg_filesR�R((R
s//sys/lib/python2.7/site-packages/nose/config.pyt
_parseArgs�s	cCs=|j}|d
kr!tj}nt|dg�}|j||�\}}t|dg�r{|j||j�\}}n||_|r�||_n|jd
k	r�|jj	t
|j��n|jd
k	r�jdkr�j|_
q�|j
s|jdd
�|_
n|js3|jdg�|_n|jsT|jdg�|_n|jsu|jdg�|_n|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j|_|j�|jstt_n|j
d
k	r"|j|j
�n|j rCt!j"|j �|_ n|jr�t#t!j"t
|j��|_t$j%d|j�nt$j%d|j&�|jr�t#t!j"t
|j��|_t$j%d|j�n|jr
t#t!j"t
|j��|_t$j%d	|j�n|j's9|j(j)||�|j(j*�nd
S(s�Configure the nose running environment. Execute configure before
        collecting tests with nose.TestCollector to enable output capture and
        other features.
        tfilesit
NOSE_WHEREtNOSE_IGNORE_FILEStNOSE_INCLUDEtNOSE_EXCLUDEsIgnoring files matching %ssIncluding tests matching %ssExcluding tests matching %sN(i(+RKRReR�tgetattrR�R�RqRxR+RR|tversion_infoR{RWRkRlRcR_RvRzRhRRaRbRmR�tconfigureLoggingtbyteCompileRttdont_write_bytecodetconfigureWhereR]R[R\RjtlogtinfoRitshowPluginsRrR�tbegin(R
R�tdocRKR�RqRG((s//sys/lib/python2.7/site-packages/nose/config.pyR�
sh						
						c
CsI|jr*ddlm}||j�dStjd�}|jrWtj|j�}ntj|j�}|j	|�tj
d�}d|_t}|jr�jj|j�}x�|jD]3}t|�tjkr�|j|kr�t}q�q�WnDxA|jD]6}t|�tjkr|j|jkrt}qqW|sP|j|�ntj}|jdkrqd}n6|jdkr�tj}n|jd	kr�tj}n|j|�|jrEg|jjd
�D]}	|	r�|	^q�}
xZ|
D]O}tj
|�}|jtj�|jr�jd�r�j|�q��ndS(sConfigure logging for nose, or optionally other packages. Any logger
        name may be set with the debug option, and that logger will be set to
        debug level and be assigned the same handler as the nose loggers, unless
        it already has a handler.
        i�(t
fileConfigNs$%(name)s: %(levelname)s: %(message)stnoseiiiit,(Rmtlogging.configR�tloggingt	FormatterRbtFileHandlert
StreamHandlerRotsetFormattert	getLoggert	propagateR^RXtpathtabspaththandlersttypetbaseFilenameRtRwt
addHandlertWARNINGRztDEBUGtINFOtsetLevelRatsplitR�(
R
R�tformatthandlertloggertfoundtdebugLogAbsPaththtlvlRt
debug_loggerstlogger_nametl((s//sys/lib/python2.7/site-packages/nose/config.pyR�[sP	
	
		
		
	
cCsddlm}d|_t|�}t}x�|D]�}|js�t|�}|dkrltd|��ntj	d|�||_|j
r2tjj
tjj|d��r2tj	d|�||�q2q2n|s�dt�n|jj|�q2WdS(	sIConfigure the working directory or directories for the test run.
        i�(tadd_paths2Working directory %s not found, or not a directorysSet working dir to %ss__init__.pys5Working directory %s is a package; adding to sys.paths�Use of multiple -w arguments is deprecated and support may be removed in a future release. You can get the same behavior by passing directories without the -w argument on the command line, or by using the --tests argument in a configuration file.N(t
nose.importerR�RR~RR^Rt
ValueErrorR�R�R_RXR�texistsR�RtDeprecationWarningRxR (R
R{R�twarnedR�tabs_path((s//sys/lib/python2.7/site-packages/nose/config.pyR��s,	
	
		!	

cCs|jj|j�dS(s-Reset all config values to defaults.
        N(R�R�R�(R
((s//sys/lib/python2.7/site-packages/nose/config.pytdefault�scCs|jr|jS|j}|j|�}|jdddddddtdd	�|jd
ddddddtdd
�|jddddddd|jdd�|jddddddddddd�|jdddddddddd�|jd d!dd"dd#dd$dd%�|jd&d'dd"dd(dd)dd*�|jd+dd"dd,dd-dd.�|jd/d0d1dddd2dd3dd4|jd|j�|jd5dddd6ddjdd7dd8�|jd9d:dddd;d|jdd<�|jd=dd>ddd|j	dd?dd@�|jdAdBddCddd|j
dd?ddD�|jdEdFdd"ddGdd3ddH�|jdIdJdd"ddKdd3ddL�|jdMdNdd"ddOdd3ddP�|jdQdRddddSd|jddT�|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_truetdesttversionR�RsOutput nose version and exits-ps	--pluginsR�s[Output list of available plugins and exit. Combine with higher verbosity for greater details-vs	--verbosetcountRzsBe more verbose. [NOSE_VERBOSE]s--verbositytstoretmetavart	VERBOSITYR�Rys.Set verbosity; --verbosity=2 is the same as -vs-qs--quiettstore_consttconstisBe less verboses-cs--configR R�tFILESs�Load 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]tREGEXs�Files, directories, function names, and class names that match this regular expression are considered tests.  Default: %s [NOSE_TESTMATCH]s--testsRxtNAMESs�Run 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--debugRas�Activate 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	--includeRls�This 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-adjustmenttstore_falseR_sCDon't make any changes to sys.path when loading tests [NOSE_NOPATH]s--exeRhs�Look 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-winsR�s�nose'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-compileR�siPrevent nose from byte-compiling the source into .pyc files while nose is scanning for and running tests.N(RRKR�t
add_optionR^RzRZRRaRbRmRvR_RhRRtRrR�t
pluginOpts(R
R�RKR((s//sys/lib/python2.7/site-packages/nose/config.pyR��s�				


				

	cCs|j|�j�S(s*Return the generated help message
        (R�tformat_help(R
R�((s//sys/lib/python2.7/site-packages/nose/config.pyRQscCs|jj||j�dS(N(RrR�RK(R
R((s//sys/lib/python2.7/site-packages/nose/config.pyR�VscCs|jj|j�dS(N(R�R�R�(R
((s//sys/lib/python2.7/site-packages/nose/config.pytresetYscCs
|jj�S(N(R�R�(R
((s//sys/lib/python2.7/site-packages/nose/config.pyttodict\scCs|jj|�dS(N(R�R�(R
R�((s//sys/lib/python2.7/site-packages/nose/config.pyR�_sN(RRRIRR�R�R�t__str__R�RR�R�R�R�R�RR�R�R�R�(((s//sys/lib/python2.7/site-packages/nose/config.pyRJ�s"%	+					N	;		�			RpcBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s9Options container that returns None for all options.
    cCsiS(N((R
((s//sys/lib/python2.7/site-packages/nose/config.pyR�fscCsdS(N((R
R�((s//sys/lib/python2.7/site-packages/nose/config.pyR�iscCsdS(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(RRRIR�R�R�R�R�(((s//sys/lib/python2.7/site-packages/nose/config.pyRpcs				cCs"ttjjttjjt��S(s2Return path to any existing user config files
    (tfilterRXR�R�Rjt
expanduserR6(((s//sys/lib/python2.7/site-packages/nose/config.pytuser_config_filesvscCs*t�}tjjd�r&|dgS|S(slReturn path to any existing user config files, plus any setup.cfg
    in the current working directory.
    s	setup.cfg(R�RXR�R�(tuser((s//sys/lib/python2.7/site-packages/nose/config.pytall_config_files}s	c	CsR|dkrtS|dkr tSt|�}t|�dkrBtS|j�dkS(
s(Does the value look like an on/off flag?iiit1t0tFtTtTRUEtFALSEtONtOFF(R�R�R�R�R�R�R�R(RtR^R*tlentupper(tval((s//sys/lib/python2.7/site-packages/nose/config.pytflag�scCst|�j�dkS(NR�R�R�R�(R�R�sTRUEsON(R*R(R((s//sys/lib/python2.7/site-packages/nose/config.pyt_bool�s(R�R@RXR[ReR&Rt	nose.utilRRtnose.plugins.managerRtwarningsRR�RR�R?R6RgR
R	RtobjectRRJRpR�R�RR(((s//sys/lib/python2.7/site-packages/nose/config.pyt<module>s0	d�			

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.