nose-testconfig

Software Screenshot:
nose-testconfig
Software Details:
Version: 0.8
Upload Date: 11 May 15
Developer: Jesse Noller
Distribution Type: Freeware
Downloads: 4

Rating: nan/5 (Total Votes: 0)

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.

What is new in this release:

  • unicode support for config files (dhellmann)
  • colons are allowed in user's arguments, such as --tc url:127.0.0.1:5000 (aconrad)
  • config file is not longer required, --tc option may be provided alone (aconrad)

What is new in version 0.6:

  • Add in checking for 3 different environment variables corresponding to the supported config file types. Setting one of these to the full path to a given configuration file will force nose-testconfig to autoload that file. Handy if you want to run a test which imports the testconfig module through something like pychecker (or run it from the command line).

Requirements:

  • Python

Similar Software

pytest-marks
pytest-marks

15 Apr 15

Tail
Tail

3 Jun 15

pyzombie
pyzombie

12 May 15

tl.testing
tl.testing

15 Apr 15

Comments to nose-testconfig

Comments not found
Add Comment
Turn on images!