nose-testconfig 0.8

Test configuration plugin for Nose

  Add it to your Download Basket!

 Add it to your Watch List!


Rate it!

What's new in nose-testconfig 0.8:

  • unicode support for config files (dhellmann)
  • colons are allowed in user's arguments, such as --tc url: (aconrad)
  • config file is not longer required, --tc option may be provided alone (aconrad)
Read full changelog
send us
an update
The Apache License 2.0 
Jesse Noller
ROOT \ Programming \ Quality Assurance and Testing
nose-testconfig is a simple test configuration plugin for nose designed to easily allow data about a system-under-test to be passed in via a configuration file via nosetests.

It is meant to be simple, flexible and clear. It current support YAML, INI and pure Python configuration files.

What It Does

nose-testconfig is a plugin to the nose test framework which provides a faculty for passing test-specific (or test-run specific) configuration data to the tests being executed.

Currently configuration files in the following formats are supported:

 * YAML (via PyYAML)
 * INI (via ConfigParser)
 * Pure Python (via Exec)

The plugin is meant to be flexible, ergo the support of exec'ing arbitrary python files as configuration files with no checks. The default format is assumed to be ConfigParser ini-style format.

The plugin provides a method of overriding certain parameters from the command line (assuming that the main "config" object is a dict) and can easily have additional parsers added to it.

Test Usage

For now (until something better comes along) tests can import the "config" singleton from testconfig:

from testconfig import config

By default, YAML files parse into a nested dictionary, and ConfigParser ini files are also collapsed into a nested dictionary for foo[bar][baz] style access. Tests can obviously access configuration data by referencing the relevant dictionary keys:

from testconfig import config
def test_foo():
 target_server_ip = config['servers']['webapp_ip']

Warning: Given this is just a dictionary singleton, tests can easily write into the configuration. This means that your tests can write into the config space and possibly alter it. This also means that threaded access into the configuration can be interesting.

When using pure python configuration - obviously the "sky is the the limit" - given that the configuration is loaded via an exec, you could potentially modify nose, the plugin, etc. However, if you do not export a config{} dict as part of your python code, you obviously won't be able to import the config object from testconfig.

When using YAML-style configuration, you get a lot of the power of pure python without the danger of unprotected exec() - you can obviously use the pyaml python-specific objects and all of the other YAML creamy goodness.

Last updated on April 20th, 2011


#test configuration #Nose plugin #Python library #Nose #test #configuration #plugin

Add your review!