0001# Copyright (C) 2006 Kumar McMillan
0002
0003# This library is free software; you can redistribute it and/or
0004# modify it under the terms of the GNU Lesser General Public
0005# License as published by the Free Software Foundation; either
0006# version 2.1 of the License, or (at your option) any later version.
0007
0008"""Tools for controlling test environments.
0009
0010This package came to life while developing real test suites for applications and libraries, 
0011so nothing has been added here that wasn't necessary for some task or another.  
0012`Python`_ is of course the ultimate testing tool.
0013
0014In my own experience with testing, it pays to get as close to the real world as possible.
0015I try to use stub or mock objects only as a last resort, for optimization, etc.  Thus, the crux of this package is the `fixtures` module -- 
0016it provides the means to load mock data into a real database (or any storage medium).  
0017
0018Patches are welcome, preferably with tests ;)  The current project is being trac'ed at http://testtools.python-hosting.com/
0019
0020See docs on each individual module for examples and usage.
0021
0022.. _Python: http://python.org/
0023
0024"""
0025
0026__all__ = [ 'fixtures', 'io', 'stubs', 'storage', 'config',
0027            'exceptions', 'bgtests', '__version__', ]
0028__repos_url__ = '$HeadURL: https://svn.testtools.python-hosting.com/tags/0.7.1/testtools/__init__.py $'
0029
0030import sre
0031
0032_ver_pattern = sre.compile('(?:branches|tags)/([^/]+)/')
0033
0034def release_version(repos_url = __repos_url__):
0035    '''get a release version string based on the 
0036    branch/tag in the repos url for this file
0037    
0038    '''
0039    m = _ver_pattern.search(repos_url)
0040    if m:
0041        return m.group(1)
0042    else:
0043        return 'dev'
0044
0045__version__ = release_version()