Changeset 27
- Timestamp:
- Mon Apr 24 22:21:13 2006
- Files:
-
- trunk/nose/core.py (modified) (diff)
- trunk/nose/__init__.py (modified) (diff)
- trunk/scripts/mkrelease.py (modified) (diff)
- trunk/scripts/mkwiki.py (modified) (diff)
- trunk/MANIFEST.in (modified) (diff)
- trunk/README.txt (modified) (diff)
- trunk/mkindex.py (deleted)
- trunk/st (deleted)
- trunk/mkrelease.py (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
trunk/nose/core.py
r26 r27 29 29 default. Any other loader may be used so long as it implements 30 30 loadTestsFromDir(). 31 """ 32 31 """ 33 32 def __init__(self, conf, loader=None): 34 33 if loader is None: … … 59 58 enable output capture and assert introspection. 60 59 """ 61 # FIXME somehow restrict plugin methods 62 conf = configure(env=os.environ) 60 # plugins that implement any of these methods are disabled, since 61 # we don't control the test runner and won't be able to run them 62 setuptools_incompat = ( 'finalize', 'prepareTest', 'report', 63 'setOutputStream') 64 65 conf = configure(env=os.environ, disable_plugins=setuptools_incompat) 63 66 Result.conf = conf 64 67 loader = defaultTestLoader(conf) … … 130 133 deprecated. Skipped and deprecated tests do not count as failures, 131 134 but details on them are printed at the end of the test run along 132 with any failures and er orrs.135 with any failures and errors. 132 135 133 136 Selecting Tests … … 141 144 Test names specified may be file or module names, and may optionally 142 145 indicate the test case to run by separating the module or file name 143 from the test case name with a colon. Examples:: 146 from the test case name with a colon. Filenames may be relative or 147 absolute. Examples:: 144 148 145 149 %prog test.module … … 167 171 Further customization of test selection and loading is possible 168 172 through the use of plugins. 173 174 Test result output is identical to that of unittest, except for the 175 additional features (output capture, assert introspection, and any plugins 176 that control or produce output) detailed in the options below. 169 177 """ 170 178 verbosity = 1 … … 183 191 raise ValueError("TestProgram argument defaultTest must be " 184 192 "a callable with the same signature as " 185 " TestCollector()")193 "nose.TestCollector") 185 193 186 194 if argv is None: … … 223 231 return self.success 224 232 225 def configure(argv=None, env=None, help=False): 233 def configure(argv=None, env=None, help=False, disable_plugins=None): 225 233 """Configure the nose running environment. Execute configure before 226 collecting tests with nose. collector()to enable output capture and234 collecting tests with nose.TestCollector to enable output capture and 226 234 other features. 227 235 """ … … 320 328 for plug in all_plugins: 321 329 plug.configure(options, conf) 330 if plug.enabled and disable_plugins: 331 for meth in disable_plugins: 332 if hasattr(plug, meth): 333 plug.enabled = False 334 log.warning("Plugin %s disabled: not all methods " 335 "supported in this environment" % plug.name) 336 322 337 323 338 # configuration works by setting class-level defaults -
trunk/nose/__init__.py
r21 r27 21 21 22 22 import nose 23 nose.run() 23 result = nose.run() 23 23 24 Lastly, you can run nose.core directly, which will run nose.main():: 24 `result` will be true if the test run succeeded, or false if any test failed 25 or raised an uncaught exception. Lastly, you can run nose.core directly, which 26 will run nose.main():: 25 27 26 28 python /path/to/nose/core.py … … 90 92 environment variables detailed in the nosetests script usage message. 91 93 92 Please note that when run under setuptools, some plugins will not be 93 available, including the builtin coverage, profiler, and missed test 94 Please note that when run under the setuptools test command, some plugins will 95 not be available, including the builtin coverage, profiler, and missed test 94 96 plugins. 95 97 95 97 nose 1.0 will include a custom setuptools command that will enable all 96 plugins available when running nosetests.98 plugins. 96 98 97 99 .. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools … … 194 196 test = with_setup(setup_func,teardown_func)(test) 195 197 196 or:: 198 or by direct assignment:: 196 198 197 199 test.setup = setup_func … … 227 229 The setup and teardown functions will be executed for each test that the 228 230 generator returns. 231 232 For generator methods, the setUp and tearDown methods of the class (if any) 233 will be run before and after each generated test case. 234 235 Please note that method generators `are not` supported in unittest.TestCase 236 subclasses. 229 237 230 238 About the name -
trunk/scripts/mkrelease.py
r26 r27 9 9 success = 0 10 10 11 current = os.getcwd() 12 13 here = os.path.dirname(os.path.dirname(__file__)) 14 os.chdir(here) 15 11 16 def runcmd(cmd): 12 17 print cmd … … 18 23 19 24 # make docs 20 runcmd('./mkindex.py') 25 runcmd('%s/scripts/mkindex.py' % here) 26 runcmd('%s/scripts/mkwiki.py' % here) 21 27 22 28 # make branch 23 runcmd('bzr branch . ../nose_dev-%s' % version) 29 # old: runcmd('bzr branch . ../nose_dev-%s' % version) 30 runcmd('svk copy %s %s/../branches/%s-stable' % (here, here, version)) 31 32 # make tag 33 runcmd('svk copy %s %s/../tags/%s-release' % (here, here, version)) 24 34 25 35 # setup sdist … … 33 43 'upload': os.environ['NOSE_UPLOAD'] } 34 44 runcmd(cmd) 35 tmp = os.getcwd() 36 os.chdir('../nose_dev-%s' % version) 37 cmd = 'rsync -avzI --delete -e ssh . %sbranch' % os.environ['NOSE_UPLOAD'] 38 runcmd(cmd) 39 os.chdir(tmp) 45 46 # FIXME push the branch & tag to master svn server 47 48 # tmp = os.getcwd() 49 # os.chdir('../nose_dev-%s' % version) 50 # cmd = 'rsync -avzI --delete -e ssh . %sbranch' % os.environ['NOSE_UPLOAD'] 51 # runcmd(cmd) 52 # os.chdir(tmp) 40 53 -
trunk/scripts/mkwiki.py
r26 r27 32 32 33 33 for k in modlinks: 34 doc = re.sub(k, '`' + modlinks[k] + '`:trac`', doc) 34 doc = re.sub(k, '`' + modlinks[k] + '`:trac', doc) 35 36 doc = '`This page is autogenerated. Please add comments only ' \ 37 'beneath the horizontal rule at the bottom of the page. ' \ 38 'Changes above that line will be lost when the page is '\ 39 'regenerated.`\n\n' + doc 35 40 36 41 return '{{{\n#!rst\n%s\n}}}\n' % doc … … 64 69 # 65 70 66 # FIXME want some 'autogenerated from... ' text in each67 71 pages = { #'SandBox': wikirst(section(nose.__doc__, 'Writing tests')) 68 72 'WritingTests': wikirst(section(nose.__doc__, 'Writing tests')), … … 70 74 'WritingPlugins': wikirst(nose.plugins.__doc__), 71 75 'PluginInterface': plugin_interface(), 76 # FIXME finish example plugin doc 72 77 # 'ExamplePlugin': example_plugin(), 73 78 74 # FIXME: this produces invalid rst, wants to be all in one big 75 # literal text section; also gets wrong program name 76 # also need to remove example plugin section 79 # FIXME: need to remove example plugin section and html-output section 77 80 'NosetestsUsage': '\n{{{\n' + 78 81 nose.configure(help=True).replace('mkwiki.py', 'nosetests') + -
trunk/MANIFEST.in
r4 r27 1 1 include AUTHORS 2 2 include ez_setup.py 3 include selftest.py 4 include st/*.py 5 include st/*/*.py 6 include st/*/*/*.py 7 include st/*/*/*/*.py 8 include st/*/*/*/*/*.py 3 include unit_tests/*/*.py 4 include unit_tests/*/*/*.py 5 include unit_tests/*/*/*/*.py 6 include unit_tests/*/*/*/*/*.py 9 7 include CHANGELOG 10 8 include NEWS 9 include README.txt 11 10 include lgpl.txt -
trunk/README.txt
r23 r27 21 21 22 22 import nose 23 nose.run() 23 result = nose.run() 23 23 24 Lastly, you can run nose.core directly, which will run nose.main():: 24 `result` will be true if the test run succeeded, or false if any test failed 25 or raised an uncaught exception. Lastly, you can run nose.core directly, which 26 will run nose.main():: 25 27 26 28 python /path/to/nose/core.py … … 90 92 environment variables detailed in the nosetests script usage message. 91 93 92 Please note that when run under setuptools, some plugins will not be 93 available, including the builtin coverage, profiler, and missed test 94 Please note that when run under the setuptools test command, some plugins will 95 not be available, including the builtin coverage, profiler, and missed test 94 96 plugins. 95 97 95 97 nose 1.0 will include a custom setuptools command that will enable all 96 plugins available when running nosetests.98 plugins. 96 98 97 99 .. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools … … 194 196 test = with_setup(setup_func,teardown_func)(test) 195 197 196 or:: 198 or by direct assignment:: 196 198 197 199 test.setup = setup_func … … 227 229 The setup and teardown functions will be executed for each test that the 228 230 generator returns. 231 232 For generator methods, the setUp and tearDown methods of the class (if any) 233 will be run before and after each generated test case. 234 235 Please note that method generators `are not` supported in unittest.TestCase 236 subclasses. 229 237 230 238 About the name
