nose-testconfig

Test configuration plugin for Nose
Download

nose-testconfig Ranking & Summary

Advertisement

  • Rating:
  • License:
  • The Apache License 2.0
  • Price:
  • FREE
  • Publisher Name:
  • Jesse Noller
  • Publisher web site:
  • http://code.google.com/u/jnoller/

nose-testconfig Tags


nose-testconfig Description

Test configuration plugin for Nose 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 Doesnose-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 UsageFor now (until something better comes along) tests can import the "config" singleton from testconfig:from testconfig import configBy default, YAML files parse into a nested dictionary, and ConfigParser ini files are also collapsed into a nested dictionary for foo style access. Tests can obviously access configuration data by referencing the relevant dictionary keys:from testconfig import configdef test_foo(): target_server_ip = configWarning: 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. Requirements: · Python What's New in This Release: · 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).


nose-testconfig Related Software