My favorites | Sign in
Project Logo
                
Search
for
Updated May 05, 2007 by jpellerin
Labels: Phase-Design, Docs-Reference, Featured
VersionZeroTen  

# New features and other changes coming in version 0.10

Introduction

Nose version 0.10 will see its first preview release relatively soon. This document outlines some of the major changes and features to expect in the new version.

This document is currently in progress. It is not complete and anything in it is subject to change, expansion or removal before 0.10 is released. Features or changes that are planned but not yet implemented are marked (planned).

In once sentence

0.10 increases unittest compatibility (and thereby the utility of individual parts of nose without the whole framework), and makes plugins more powerful and easier to write.

Details

Architecture changes

  • New loader that is more compatible with unittest.TestLoader
    • loadTestsFromNames actually loads tests from the given names. The default nosetests action of loading tests in the current working directory is spelled loader.loadTestsFromNames(['.'])
  • Handling of fixtures generalized and expanded
    • A single ContextSuite class replaces ModuleSuite, etc
    • Modules are imported at load time, not in setup phase of module-level fixture
    • ContextSuiteFactory can be used as loader.suiteClass replacement
  • Many core features now plugins
    • output capture
    • assert introspection
    • pdb on errors
    • skipped/deprecated tests
      • other special handling for different exception classes easy to add

Command line interface changes

  • multiple -w arguments deprecated
    • just pass the same paths without -w
    • -w means 'working directory' again -- all other paths are relative to this directory
    • new --tests=test,test2,test3 argument replaces -w test -w test2 -w test3
  • nosetests will look for tests in any path passed on the commandline, removing the 'must look like a test' requirement of 0.9
  • config file .noserc (default name) support
    • setup.cfg also used
    • config files loaded in all running environments (nosetests, python setup.py test, python setup.py nosetests)

Plugin API changes

  • Plugin Managers
    • Allows easy replacement of plugin loading and calling
  • New entry point nose.plugins.0-10
  • New calls
    • prepareTestLoader
    • prepareTestResult
    • prepareTestRunner
    • beforeTest
    • aftertest
    • prepareTestCase
    • beforeImport
    • afterImport
    • beforeContext
    • afterContext
    • startContext
    • stopContext
    • makeTest
    • loadTestsFromNames
  • Automatic compatibility wrapper for 0.9 plugins
    • Loads plugins with old entry point nose.plugins, wraps in adapter class
    • Imperfect, especially where plugins manipulate nose internals

Other new features

  • Universal test wrapper (nose.case.Test) always passed to plugins
    • supports address() method -- returns nose test_address tuple of test case
    • supports context attribute -- the surrounding context of the test (a class or module)
  • Support for class-level fixtures
  • New testid plugin for easier roundtripping
    • adds id to each test
    • run that test again by passing its id


Sign in to add a comment
Hosted by Google Code