Changeset 4539
- Timestamp:
- 04/29/08 02:18:00 (3 months ago)
- Files:
-
- projects/ToscaWidgets/branches/nosetests-integration/setup.cfg (modified) (2 diffs)
- projects/ToscaWidgets/branches/nosetests-integration/setup.py (modified) (2 diffs)
- projects/ToscaWidgets/branches/nosetests-integration/tests/__init__.py (modified) (1 diff)
- projects/ToscaWidgets/branches/nosetests-integration/tests/test_wsgiapps.py (modified) (1 diff)
- projects/ToscaWidgets/branches/nosetests-integration/tw/core/__init__.py (modified) (1 diff)
- projects/ToscaWidgets/branches/nosetests-integration/tw/core/testutil.py (modified) (3 diffs)
- projects/ToscaWidgets/branches/nosetests-integration/tw/core/util.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
projects/ToscaWidgets/branches/nosetests-integration/setup.cfg
r4434 r4539 1 1 [aliases] 2 2 release = egg_info -RDb "" sdist bdist_egg register upload 3 test = nosetests 3 4 4 5 [egg_info] … … 16 17 docformat = reStructuredText 17 18 trac_browser_url = /trac/tw/browser 19 20 [nosetests] 21 verbosity = 2 22 with-coverage = false 23 cover-package = tw 24 with-toscawidgets = true 25 exclude-file = tw/mods/tg.py 26 tw/mods/pylonshf.py 27 tw/core/mako_util.py 28 with-doctest = true 29 doctest-extension = txt projects/ToscaWidgets/branches/nosetests-integration/setup.py
r4425 r4539 74 74 author_email=__EMAIL__, 75 75 license=__LICENSE__, 76 test_suite = 'tests',77 76 packages = PACKAGES, 78 77 namespace_packages = ['tw', 'tw.mods'], … … 100 99 [paste.filter_app_factory] 101 100 middleware = tw.api:make_middleware 101 102 [nose.plugins] 103 toscawidgets = tw.testutil:TWNosePlugin 102 104 """, 103 105 zip_safe=False, projects/ToscaWidgets/branches/nosetests-integration/tests/__init__.py
r4535 r4539 1 import os2 import pkg_resources3 4 import tw.api5 from tw.core.testutil import get_doctest_suite6 7 dist_base = pkg_resources.get_distribution('ToscaWidgets').location8 9 DOCTEST_FILES = [10 os.path.join(dist_base, 'docs', '*.txt'),11 os.path.join(dist_base, 'tests', 'test_*.txt'),12 os.path.join(dist_base, 'README.txt'),13 ]14 15 DOCTEST_MODULES = [16 "tw.core.base",17 "tw.core.meta",18 "tw.core.util",19 "tw.core.resources",20 "tw.core.genericfunctions",21 "tw.core.view",22 "tw.core.js",23 ]24 25 def additional_tests():26 return get_doctest_suite(DOCTEST_FILES, DOCTEST_MODULES)projects/ToscaWidgets/branches/nosetests-integration/tests/test_wsgiapps.py
r4474 r4539 7 7 from tw.core.testutil import RequireMixin 8 8 9 examples_dir = os.path.join(pkg_resources.get_distribution('ToscaWidgets').location, 10 'examples') 9 examples_dir = os.path.join( 10 pkg_resources.get_distribution('ToscaWidgets').location, 'examples' 11 ) 11 12 sys.path.insert(0, examples_dir) 12 13 projects/ToscaWidgets/branches/nosetests-integration/tw/core/__init__.py
r4475 r4539 1 from pkg_resources import require 2 require('ToscaWidgets') 3 del require 4 1 5 from exceptions import * 2 6 from meta import * projects/ToscaWidgets/branches/nosetests-integration/tw/core/testutil.py
r4425 r4539 1 import os 1 2 import sys 2 3 import doctest 3 4 4 from new import instancemethod 5 5 from glob import glob 6 6 from unittest import TestCase 7 7 from itertools import imap, chain 8 from tw.core.util import install_framework9 8 10 9 import pkg_resources 10 from nose.plugins import Plugin 11 11 12 12 13 __all__ = [ … … 42 43 widget_kw = {} 43 44 def setUp(self): 44 install_framework(force=True)45 45 if hasattr(self, 'TestWidget'): 46 46 self.widget = self.TestWidget('test', **self.widget_kw) … … 132 132 pass # Mod has probably no doctests... ignore it 133 133 return suite 134 135 class TWNosePlugin(Plugin): 136 """Makes sure a dummy tw.framework is installed before any test is run""" 137 138 name = 'toscawidgets' 139 enabled = False 140 score = 1000 141 142 def add_options(self, parser, env=os.environ): 143 super(TWNosePlugin, self).add_options(parser, env) 144 parser.add_option('--exclude-file', 145 dest='exclude', 146 action = 'append', 147 default=[], 148 help="Do not try to import this file") 149 150 def configure(self, options, conf): 151 super(TWNosePlugin, self).configure(options, conf) 152 self.exclude = set(*(chain(op.split() for op in options.exclude))) 153 154 def begin(self): 155 if self.enabled: 156 from tw.core.util import install_framework 157 install_framework(True) 158 159 def wantFile(self, file): 160 relpath = file.replace(os.getcwd(), '').lstrip('/') 161 return relpath.endswith('.py') and relpath not in self.exclude projects/ToscaWidgets/branches/nosetests-integration/tw/core/util.py
r4428 r4539 260 260 def install_framework(force=False): 261 261 import tw 262 assert False, tw.__file__ 262 263 if not hasattr(tw, 'framework') or force: 263 264 from paste.registry import StackedObjectProxy, Registry