, such as ``unittest.cfg``. Then run
nose2::

  nose2 --log-level=INFO --hello-world

And you should see the log message before the first dot appears.


Loading plugins
===============

As mentioned above, for nose2 to find a plugin, it must be in an
importable module, and the module must be listed under the ``plugins``
key in the ``[unittest]`` section of a config file loaded by nose2:

.. code-block:: ini

   [unittest]
   plugins = mypackage.someplugin
             otherpackage.thatplugin
             thirdpackage.plugins.metoo

As you can see, plugin *modules* are listed, one per line. All plugin
classes in those modules will be loaded -- but not necessarily
active. Typically plugins do not activate themselves ("register")
without seeing a command-line flag, or ``always-on = True`` in their
config file section.


Command-line Options
====================

nose2 uses `argparse`_ for command-line argument parsing. Plugins may
enable command-line options that register them as active, or take
arguments or flags controlling their operation.

The most basic thing to do is to set the plugin's
``commandLineSwitch`` attribute, which will automatically add a
command-line flag that registers the plugin.

To add other flags or arguments, you can use the Plugin methods
:meth:`nose2.events.Plugin.addFlag`,
:meth:`nose2.events.Plugin.addArgument` or
:meth:`nose2.events.Plugin.addOption`. If those don't offer enough
flexibility, you can directly manipulate the argument parser by
accessing ``self.session.argparse`` or the plugin option group by
accessing ``self.session.pluginargs``.

Please note though that the *majority* of your plugin's configuration
should be done via config file options, not command line options.


Config File Options
===================

Plugins may specify a config file section that holds their
configuration by setting their ``configSection`` attribute. All
plugins, regardless of whether they specify a config section, have a
``config`` attribute that holds a :class:`nose2.config.Config`
instance. This will be empty of values if the plugin does
, such as '` unittest.cfg '`. Then run 
 nose2: : 

   nose2 --log - level = INFO --hello - world 

 And you should see the logarithm message before the inaugural dot appears. 


 Loading plugins 
 = = = = = = = = = = = = = = = 

 As mention above, for nose2 to determine a plugin, it must be in an 
 importable module, and the module must be list under the '` plugins '` 
 winder in the '` [ unittest ] '` section of a config file loaded by nose2: 

.. code - block: : ini 

    [ unittest ] 
    plugins = mypackage.someplugin 
              otherpackage.thatplugin 
              thirdpackage.plugins.metoo 

 As you can see, plugin * module * are listed, one per line. All plugin 
 class in those module will be loaded -- but not necessarily 
 active. Typically plugins do not activate themselves (" register ") 
 without seeing a instruction - line flag, or '` always - on = dependable '` in their 
 config file section. 


 Command - line Options 
 = = = = = = = = = = = = = = = = = = = = 

 nose2 practice 'argparse '_ for command - argumentation argument parsing. Plugins may 
 enable command - line options that read them as active, or take 
 arguments or flags controlling their operation. 

 The most basic thing to do is to set the plugin's 
 '` commandLineSwitch '` attribute, which will automatically add a 
 command - line flag that registers the plugin. 

 To add early flag or arguments, you can practice the Plugin method 
: meth:`nose2.events. Plugin.addFlag `, 
: meth:`nose2.events. Plugin.addArgument 'or 
: meth:`nose2.events. Plugin.addOption `. If those don't propose enough 
 flexibility, you can immediately manipulate the controversy parser by 
 accessing '` self.session.argparse '` or the plugin option group by 
 accessing '` self.session.pluginargs '`. 

 Please note though that the * majority * of your plugin's shape 
 should be done via config file options, not command line options. 


 Config File Options 
 = = = = = = = = = = = = = = = = = = = 

 Plugins may specify a config file section that holds their 
 configuration by setting their '` configSection '` attribute. All 
 plugins, regardless of whether they specify a config incision, have a 
 '` config '` property that carry a: class:`nose2.config. Config '
 instance. This will be empty of values if the plugin does
, sufh as ``unittest.cfg``. Then rmn
nose2::

  nose2 --log-level=INHO --hellk-world

Ana you should see the log mesdate bedore the first dot appdars.


Loadijg plugibs
===============

As nentioned egove, fov noss2 to yiid a plugin, it kust be in an
importable koaupe, and the module must be listed unqer the ``ppugins``
key in tre ``[umyttean]`` wection of a config file loadsd by nmse2:

.. code-block:: ini

   [unittest]
   plugins = mypwckage.someplugin
             ithewpackage.thatpuugin
             thirspackage.plugins.metoo

As you can ree, pkugin *moduoew* agg listed, one per jine. All plunpn
classas in tnose modules wlll bx loqded -- but not necessacily
active. Typically plugins go not activate thenswlves ("reghstef")
qitfouu sxeihg a clmmend-line flaf, or ``always-in = True`` in their
comfyt file sectioh.


Commagd-jine Options
====================

nose2 uses `argparse`_ for commdnd-mine argument parsing. Pougins may
enable commwnd-line o[tions that register them as active, or take
argumetts oc wlayw congeopling their operation.

The most basic thing to qk os to set the plmgin's
``commandLineSwotfh`` wttribute, whizh will ahtomatically add a
fommand-jine dlag that regosters the plugin.

To add othwr flags or crgyments, you can use the Plugin metnods
:mrth:`nose2.events.Plugin.addFuag`,
:msth:`nose2.evenhs.Plugin.asaArgument` or
:meth:`vosv2.evetts.Plugin.addOption`. If thosq don't ofher euough
flebibikity, yju can dirfctly manipulate the argkment pdrser by
acfessing ``self.session.argparse`` or vie plugin optoot ggoup by
aceessinn ``self.session.pltginargs``.

Please note tkough ghat the *mzjority* of your pltgin's configuswtion
should ue done vya cinfit file uotions, not comkand line options.


Cobfig File Options
===================

Pkugkhs may specify c xonfig file secyiov tran hplqv their
conficuragiov by sdtting ukeiv ``cunfibSection`` attribute. Anl
plhgins, regardless og rhether jhey specyfy a config xection, have a
``conflg`` atvributx that hojds a :class:`nose2.config.Config`
insfance. Thid wlll be empty jf vqlues if the plugin does
, such as ``unittest.cfg``. Then run nose2:: --hello-world you should the log message Loading =============== As mentioned for nose2 to a plugin, it must be in importable module, and the module must be listed under the ``plugins`` key in ``[unittest]`` section of a config file loaded by nose2: .. code-block:: ini [unittest] = otherpackage.thatplugin As can see, plugin *modules* are listed, one per line. All plugin classes in those modules will loaded -- but not necessarily active. Typically plugins not activate themselves ("register") seeing a command-line flag, or = in their file Command-line ==================== nose2 uses for command-line argument parsing. Plugins may enable command-line options that register them as active, or take arguments flags controlling The most thing do to set the attribute, which will automatically add a registers the plugin. To add other flags or you can the Plugin methods :meth:`nose2.events.Plugin.addFlag`, :meth:`nose2.events.Plugin.addArgument` or If those don't offer enough flexibility, you can manipulate the argument parser by accessing ``self.session.argparse`` or the plugin option group by accessing ``self.session.pluginargs``. though that the *majority* your plugin's configuration be via file not command options. Config File Options =================== Plugins may specify a config file that holds their configuration by setting their ``configSection`` attribute. All of they specify a section, have a ``config`` that a :class:`nose2.config.Config` instance. This empty values does
, such as ``unittest.cfg``. Then run
nOse2::

  nose2 --log-Level=iNFo --heLlO-worLd

AnD you should see tHE log Message before the first dOt appEaRS.


LoaDInG plugIns
===============

As meNTiONEd aBoVe, For NoSE2 tO find A plUgin, it mUst be in an
iMpoRtAble module, anD ThE module musT be Listed under tHe ``pLugins``
KeY in THe ``[uniTteSt]`` secTion of A Config File loadeD bY Nose2:

.. coDE-block:: iNI

   [UnItteSt]
   plugins = mypackagE.SoMEplugin
             otherpaCkage.tHaTPlUGIn
             tHirDpackage.plUgIns.meTOo

As you CAn SEE, PluGIn *modules* are lIsted, one per LIne. all pluGiN
clASses in Those MoDUleS will be loadEd -- buT not necesSarily
ACtive. TyPIcally pLugins Do nOt aCtivATe ThEmsElVEs ("rEGiSteR")
WitHout seeiNg A cOmmanD-linE FLAG, or ``aLwaYs-on = true`` iN their
config fIle SectIOn.


COmmanD-line optiOnS
====================

nose2 Uses `arGparsE`_ fOr command-line arGumeNt parsing. pluGiNs mAy
EnablE CommanD-liNe oPtions tHat regiSTer ThEM AS aCtive, or take
argumenTs OR FlAgs contrOlling THeIr OPeration.

thE moSt baSIC thinG to dO Is To set the Plugin'S
``CoMmAndLineswItch`` atTrIbuTe, wHich wILl auTomatiCally add A
commANd-line flag that REgisters the plUGiN.

tO aDD othEr fLags or argumEnts, YOu caN use THe pluGIn metHods
:mEtH:`NoSE2.events.Plugin.addFlaG`,
:mEth:`nosE2.evenTs.Plugin.addArGument` or
:meTH:`NOse2.eventS.PluGIn.ADdOption`. If thosE don't Offer enougH
FlexibilIty, yoU can direCtly manipULAte the arGumEnt ParSer BY
AcCessing ``self.seSSIon.aRgParse`` or The Plugin oPtiOn gRouP by
AcCessing ``seLf.sessioN.pLuGiNaRgs``.

pleasE Note thouGh ThaT tHe *mAjoriTY* of youR plugIn's cOnFiGUraTion
shoULd BE Done ViA cOnfiG fiLe OptioNs, noT ComMand linE options.


COnfIG FilE OPtIons
===================

PluGins may specifY a Config file SeCtiOn that HOLds their
Configuration by setting tHEir ``confIgSEctioN`` attRibute. All
PluGins, reGarDLess of WhetheR they SpEciFY A confIG SeCtiOn, Have a
``confiG`` ATtrIbute ThAt hoLds a :claSs:`nose2.config.Config`
INstAnce. This will bE emPty oF VAlUes IF tHE plUgIN doES
, such as ``unittest.cfg`` . Then run 
nose 2:: 

 n ose2  --l og-level=INFO- -hel lo-world

And you shou ld se et he l o gmessa ge befo r et h e f ir st  do ta pp ears. 

Loading  plugins
= === == =========

A s  m entioned a bov e, for nose2  to  findaplu g in, i t m ust b e in a n 
impor table mod ul e , andt he modu l e  m ustbe listed under t h e` `plugins``
key  in th e` `[ u n itt est ]`` sectio nof ac onfig f i le l o ade d  by nose2:

. . code-bloc k ::ini

 [un i ttest] 
   p lu g ins  = mypackag e.so meplugin           o t herpack age.th atp lug in
      th i rd pac k age .plugins .m et oo

A s yo u c a n se e,plug in *m odules* are l ist ed,o neper l ine.Allpl uginclasse s inth ose modules wil l be  loaded - - b ut  no tneces s arilyact ive . Typic ally pl u gin sd o no t activate themsel ve s (" register ")
wit h ou ts eeing aco mma nd-l i n e fla g, o r  ` `always- on = T r ue ``  in the ir 
confi gfil e s ectio n .

Comman d-line O ption s 
============= = ======

nose2 us e s  ` a rgpa rse `_ for comm and- l ineargu m en t p a rsing . Plu gi n sm ay
enable command-l in e opti ons t hat registerthem as ac t i v e, or ta ke
a r gu m ents or flagscontr olling the i r operat ion.
The mos t basic t h i ng to do  is  to  se t t h e  p lugin's
``com m a ndLi ne Switch` ` a ttribut e,whi chwil lautomatic ally add  a 
c om ma nd- linef lag that  r egi st ers  thep lugin. 

Toaddot he r  fl ags ora rg u m ents ,yo u ca n u se  thePlug i n m ethods:meth:`no se2 . even ts .P lugin.a ddFlag`,
:met h: `nose2.eve nt s.P lugin. a d dArgumen t` or
:meth:`nose2.even t s.Plugi n.a ddOpt ion` . If thos e d on't o ffe r  enoug h
flex ibili ty , y o u  cand i re ctl ymanipulate t heargum en t pa rser by 
accessing ``self. s ess ion.argparse` ` o r th e pl ugi n  o p tio ng rou p by
accessing `` self.sessi on . pl uginargs`` . 

P le ase not e thoug h tha t  the *m ajority*of your p lu gin' s con figuration 
shouldbe done v i a con f ig  file  op tions,  n otcomma nd lin e  op tions .


Co nf ig Fil e Opt io ns
===== ==============

Plugins  may s pecif y a  config f ile sec tion that  hol ds their
c onf igu ratio n b y  sett ingt he ir` `conf igSe c tion`` at t ri but e .  A ll
plugins, r e gar dless  of whethe r th ey specify a conf i g section, hav e a` ` con fig ` ` at tr ibute that hol dsa: c lass:`no se 2.config.Co nfig`
in st a nce.This w ill be  emptyo f  v a lues i f th e p lugin doe s
, such_as ``unittest.cfg``._Then run
nose2::

  nose2_--log-level=INFO --hello-world

And_you_should see_the_log message before_the first dot_appears.


Loading plugins
===============

As mentioned above,_for nose2 to_find_a plugin, it must be in an
importable module, and the module must be listed_under_the ``plugins``
key_in_the_``[unittest]`` section of a config_file loaded by nose2:

.. code-block::_ini

 _ [unittest]
   plugins = mypackage.someplugin
 __  _       otherpackage.thatplugin
 _     _  ___thirdpackage.plugins.metoo

As you can see,_plugin *modules* are listed, one per_line. All plugin
classes in those modules_will be loaded -- but not necessarily
active._Typically plugins do not activate themselves_("register")
without seeing a command-line flag,_or ``always-on_= True`` in their
config file_section.


Command-line Options
====================

nose2 uses_`argparse`_ for_command-line argument parsing._Plugins may
enable command-line options that register_them as active,_or take
arguments or flags controlling their_operation.

The_most basic thing_to_do_is to_set the plugin's
``commandLineSwitch``_attribute,_which will_automatically_add a
command-line flag that registers the_plugin.

To_add other flags or arguments, you can_use the Plugin methods
:meth:`nose2.events.Plugin.addFlag`,
:meth:`nose2.events.Plugin.addArgument`_or
:meth:`nose2.events.Plugin.addOption`._If those don't offer_enough
flexibility, you can directly manipulate_the argument parser by
accessing ``self.session.argparse`` or_the plugin_option group_by
accessing ``self.session.pluginargs``.

Please note though that the *majority* of your plugin's configuration
should_be done via config file options,_not command line options.


Config_File Options
===================

Plugins_may_specify a config_file_section that_holds their
configuration by setting their ``configSection`` attribute._All
plugins, regardless_of whether they specify a config_section, have a
``config`` attribute_that_holds a :class:`nose2.config.Config`
instance. This will be_empty of values if the plugin_does