Usage

All that’s needed to setup nose-of-yeti is to register the spec codec before importing the specs. Python mechanics handle the rest. Included with nose-of-yeti is plugins for nosetests and pylint for doing just this.

Nose2

After installation, just add “noseOfYeti.plugins.nose2_plugin” to your list of nose2 plugins and something like:

[noseOfYeti]
always-on = true

to your nose2 config

Nosetests

After running setup.py (easy_install . or pip install . or even pip install noseOfYeti) you can run nosetests with --with-noy, which will enable the spec codec.

see Options for other options available.

Pylint

It is possible to use pylint with a noseOfYeti spec. All you have to do is add noseOfYeti.plugins.pylinter' to pylint’s load-plugins option.

This plugin will register the spec codec so that it can use it to determine what is in a spec file.

The codec will also make an effort to return lines from the original file (with normalized indentation) so that you don’t get too many errors about bad spacing. (codec doesn’t have any control over spaces between things)

see Options for options that are available.

Sphinx

You can add noseOfYeti.plugins.sphinx to sphinx’ extensions option to register the spec encoding so that sphinx may successfully import your tests (i.e. for automatic documentation creation)

see Options for options that are available.

Options

Nose2, Nosetests and pylint offer the same settings as shown below

Nose2 settings appear in your nose2 config under the “noseOfYeti” header and don’t appear as command line arguments.

Note that Nosetests require the settings to be prefixed by –noy; and sphinx prefixes options with noy_ and replaces dashes with underscores.

  • config-file: Location of a config file for nose of yeti
  • default-kls: Set default class for describes
  • extra-import: Set extra default imports (i.e. ‘from something import *’ ‘import thing’)
  • wrapped-setup: Wrap setups with lines at bottom of file instead of using noy_sup_* helpers
  • no-describe-attrs: Turn off giving describes a is_noy_spec attribute
  • with-default-imports: Turn on default imports for spec files

PyDev - Debugger

If you’re using PyDev debugger, you are able to set breakpoints in spec files if you can patch:

eclipse/plugins/org.python.pydev.debug_.../pysrc/pydevd_frame.py, in trace_dispatch():

    < if func_name in ('None', curr_func_name):

    > if func_name in ('None', '', curr_func_name):
Fork me on GitHub