Mercurial > mozilla > hg > ProfileManager
changeset 12:a07e53273b70
adding stubs for tests
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 06 May 2010 07:40:17 -0700 |
parents | 21bc82d8930a |
children | 5f81f9d321ba |
files | profilemanager/tests/__init__.py profilemanager/tests/test.py profilemanager/tests/test_profilemanager.txt |
diffstat | 2 files changed, 32 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/profilemanager/tests/test.py Thu May 06 07:40:17 2010 -0700 @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +""" +doctest runner +""" + +import doctest +import os + +def run_tests(): + directory = os.path.dirname(os.path.abspath(__file__)) + tests = [ test for test in os.listdir(directory) + if test.endswith('.txt') ] + + for test in tests: + doctest.testfile(test) + +if __name__ == '__main__': + run_tests()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/profilemanager/tests/test_profilemanager.txt Thu May 06 07:40:17 2010 -0700 @@ -0,0 +1,13 @@ +Test ProfileManager +=================== + +The obligatory imports: + + >>> import os + >>> from profilemanager import ProfileManager + +Get the path to the test profiles.ini file: + + >>> from pkg_resources import resource_filename + >>> path = os.path.join('tests', 'profiles', 'profiles.ini') + >>> profiles = resource_filename('profilemanager', path)