Current File : //lib/python2.7/site-packages/nose/commands.pyo |
�
d�Uc @ s� d Z y d d l m Z Wn e k
r7 d Z Z nh Xd d l m Z m Z m Z m
Z
m Z d d l m
Z
d d l m Z d � Z d e f d � � YZ d S(
s�
nosetests setuptools command
----------------------------
The easiest way to run tests with nose is to use the `nosetests` setuptools
command::
python setup.py nosetests
This command has one *major* benefit over the standard `test` command: *all
nose plugins are supported*.
To configure the `nosetests` command, add a [nosetests] section to your
setup.cfg. The [nosetests] section can contain any command line arguments that
nosetests supports. The differences between issuing an option on the command
line and adding it to setup.cfg are:
* In setup.cfg, the -- prefix must be excluded
* In setup.cfg, command line flags that take no arguments must be given an
argument flag (1, T or TRUE for active, 0, F or FALSE for inactive)
Here's an example [nosetests] setup.cfg section::
[nosetests]
verbosity=1
detailed-errors=1
with-coverage=1
cover-package=nose
debug=nose.loader
pdb=1
pdb-failures=1
If you commonly run nosetests with a large number of options, using
the nosetests setuptools command and configuring with setup.cfg can
make running your tests much less tedious. (Note that the same options
and format supported in setup.cfg are supported in all other config
files, and the nosetests script will also load config files.)
Another reason to run tests with the command is that the command will
install packages listed in your `tests_require`, as well as doing a
complete build of your package before running tests. For packages with
dependencies or that build C extensions, using the setuptools command
can be more convenient than building by hand and running the nosetests
script.
Bootstrapping
-------------
If you are distributing your project and want users to be able to run tests
without having to install nose themselves, add nose to the setup_requires
section of your setup()::
setup(
# ...
setup_requires=['nose>=1.0']
)
This will direct setuptools to download and activate nose during the setup
process, making the ``nosetests`` command available.
i����( t Command( t Configt option_blacklistt user_config_filest flagt _bool( t TestProgram( t DefaultPluginManagerc C s� g } x� | j D]� } | j d d t k r3 q n | j d d } | j d k r` | d } n d } | j r� | j d d } n | j | | | j p� d f � q W| S(
sA convert a optparse option list into a distutils option tuple listi i t
store_truet store_falset =i t ( R R N( t option_listt
_long_optsR t actiont Nonet _short_optst appendt help( t parsert opt_listt optt long_namet
short_name( ( s1 /usr/lib/python2.7/site-packages/nose/commands.pyt get_user_optionsI s
#t nosetestsc B se e Z d Z e d e � d e � � Z e j � Z e e � Z
d � Z d � Z d � Z
d � Z RS( s Run unit tests using nosetestst filest pluginsc C sm i | _ xT | j j D]F } | j d d } | j d d � } | | j | <t | | d � q Wd | _ d S( sW create the member variables, but change hyphens to
underscores
i i t -t _N( t option_to_cmdst _nosetests__parserR R
t replacet setattrR t attr( t selfR t cmd_namet option_name( ( s1 /usr/lib/python2.7/site-packages/nose/commands.pyt initialize_options` s
c C s d S( s nothing to do hereN( ( R# ( ( s1 /usr/lib/python2.7/site-packages/nose/commands.pyt finalize_optionsm s c C s� t | j d t � r� | j d � } d | _ | j � | j d � } | j } | j d � } | | _ | j � | j d � } d | _ | j � n/ | j d � | j d � } d | _ | j � | j j r� | j j
| j j � n | j j r| j j
| j j � n | j d � } d d | j g } xr | j j
� D]a \ } } | t k r^q@n t | | � }
|
d
k r@| j | j | j d d
� |
� � q@q@Wt d | d | j � d
S( sh ensure tests are capable of being run, then
run nose.main with a reconstructed argument listt use_2to3t build_pyi t egg_infot build_exti R s --whereR R t argvt configN( t getattrt distributiont Falset get_finalized_commandt inplacet runt build_libt egg_baset run_commandt install_requirest fetch_build_eggst
tests_requireR t itemsR R t extendt cfgToArgR R t _nosetests__config( R# R) t bpy_cmdt
build_pathR* R+ t ei_cmdR, R% R$ t value( ( s1 /usr/lib/python2.7/site-packages/nose/commands.pyR3 q s@
&c C s� g } d | } | j j | � } | j d k ru t | � sV t d | | f � � n t | � r� | j | � q� n | j | | g � | S( Ns --R R s Invalid value '%s' for '%s'( s
store_trues store_false( R t
get_optionR R t
ValueErrorR R R; ( R# t optnameRA R, t long_optnameR ( ( s1 /usr/lib/python2.7/site-packages/nose/commands.pyR<