Changeset 70
- Timestamp:
- Thu Jun 29 22:17:03 2006
- Files:
-
- trunk/unit_tests/test_loader.py (modified) (diff)
- trunk/unit_tests/test_plugins.py (modified) (diff)
- trunk/nose/core.py (modified) (diff)
- trunk/nose/plugins/doctests.py (modified) (diff)
- trunk/nose/plugins/cover.py (modified) (diff)
- trunk/nose/result.py (modified) (diff)
- trunk/nose/selector.py (modified) (diff)
- trunk/nose/loader.py (modified) (diff)
- trunk/CHANGELOG (modified) (diff)
- trunk/index.html.tpl (modified) (diff)
- trunk/NEWS (modified) (diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
trunk/unit_tests/test_loader.py
r62 r70 72 72 self.assertEqual(found, expect) 73 73 74 75 74 def test_load_from_names_compat(self): 76 75 c = Config() -
trunk/unit_tests/test_plugins.py
r62 r70 5 5 import nose.plugins 6 6 from optparse import OptionParser 7 import tempfile 7 8 from warnings import warn 8 9 … … 331 332 332 333 def test_options(self): 333 pass 334 opt = Config() 335 parser = OptionParser() 336 plug = MissedTests() 337 plug.add_options(parser, {}) 338 opts = [ o._long_opts[0] for o in parser.option_list ] 339 assert '--with-missed-tests' in opts 334 340 335 341 def test_match(self): … … 371 377 assert not plug.match(foo, __name__ + '.whatever') 372 378 assert not plug.match(foo, '/some/path') 379 380 def test_begin(self): 381 plug = MissedTests() 382 plug.conf = Config() 383 plug.begin() 384 assert plug.missed is None 385 386 plug.conf.tests = ['a'] 387 plug.begin() 388 self.assertEqual(plug.missed, ['a']) 389 assert plug.missed is not plug.conf.tests 390 391 def test_finalize(self): 392 plug = MissedTests() 393 plug.missed = ['a'] 394 395 out = [] 396 class dummy: 397 pass 398 399 result = dummy() 400 result.stream = dummy() 401 result.stream.writeln = out.append 402 403 plug.finalize(result) 404 self.assertEqual(out, ["WARNING: missed test 'a'"]) 405 406 class TestProfPlugin(unittest.TestCase): 407 def test_options(self): 408 parser = OptionParser() 409 conf = Config() 410 plug = Profile() 411 412 plug.add_options(parser, {}) 413 opts = [ o._long_opts[0] for o in parser.option_list ] 414 assert '--profile-sort' in opts 415 assert '--profile-stats-file' in opts 416 assert '--with-profile' in opts 417 assert '--profile-restrict' in opts 418 419 def test_begin(self): 420 plug = Profile() 421 plug.pfile = tempfile.mkstemp()[1] 422 plug.begin() 423 assert plug.prof 424 425 def test_prepare_test(self): 426 r = {} 427 class dummy: 428 def runcall(self, f, r): 429 r[1] = f(), "wrapped" 430 def func(): 431 return "func" 432 433 plug = Profile() 434 plug.prof = dummy() 435 result = plug.prepareTest(func) 436 result(r) 437 assert r[1] == ("func", "wrapped") 373 438 374 439 if __name__ == '__main__': -
trunk/nose/core.py
r62 r70 297 297 help="Don't make any changes to sys.path when " 298 298 "loading tests [NOSE_NOPATH]") 299 parser.add_option("--exe", action="store_true", 300 dest="includeExe", 299 parser.add_option("--exe", action="store_true", dest="includeExe", 301 300 default=env.get('NOSE_INCLUDE_EXE', 302 301 sys.platform=='win32'), … … 305 304 "modules, since they may not be import-safe " 306 305 "[NOSE_INCLUDE_EXE]") 306 parser.add_option("--noexe", action="store_false", dest="includeExe", 307 help="DO NOT look for tests in python modules that are " 308 "executable. (The default on the windows platform is to " 309 "do so.)") 307 310 308 311 # add opts from plugins 309 312 all_plugins = [] 310 for plugcls in load_plugins(): 313 # when generating the help message, load only builtin plugins 314 for plugcls in load_plugins(others=not help): 311 315 plug = plugcls() 312 316 try: -
trunk/nose/plugins/doctests.py
r62 r70 25 25 class Doctest(Plugin): 26 26 """ 27 Activate doctest plugin to find and run doctest in non-test modules. 27 Activate doctest plugin to find and run doctests in non-test modules. 27 27 """ 28 28 extension = None … … 34 34 dest='doctest_tests', 35 35 default=env.get('NOSE_DOCTEST_TESTS'), 36 help="Also look for doctests in test modules [NOSE_DOCTEST_TESTS]") 36 help="Also look for doctests in test modules " 37 "[NOSE_DOCTEST_TESTS]") 37 38 try: 38 39 # 2.4 or better supports loading tests from non-modules -
trunk/nose/plugins/cover.py
r62 r70 20 20 class Coverage(Plugin): 21 21 """ 22 If you have Ned Batchelder's coverage _module installed, you may22 If you have Ned Batchelder's coverage module installed, you may 22 22 activate a coverage report. The coverage report will cover any 23 23 python source module imported after the start of the test run, excluding -
trunk/nose/result.py
r62 r70 85 85 86 86 def getBuffer(self): 87 try: 88 return sys.stdout.getvalue() 89 except AttributeError: 90 # capture is probably off 91 return '' 87 if stdout: 88 try: 89 return sys.stdout.getvalue() 90 except AttributeError: 91 pass 92 # capture is probably off 93 return '' 92 94 93 95 def isDeprecated(self, err): … … 102 104 103 105 def resetBuffer(self): 104 sys.stdout.truncate(0) 105 sys.stdout.seek(0) 106 if stdout: 107 sys.stdout.truncate(0) 108 sys.stdout.seek(0) 106 109 107 110 def startTest(self, test): -
trunk/nose/selector.py
r62 r70 32 32 return True 33 33 34 log.debug('tests to check: %s', self.tests) 34 log.debug('tests to check: %s', self.tests) 34 34 matches = [ func(*test_tuple) for test_tuple in 35 35 map(split_test_name, self.tests) ] … … 62 62 filename = absfile(filename, self.conf.where) 63 63 if filename is None: 64 log. warning("File %s not found", orig)64 log.debug("File %s not found", orig) 64 64 return False 65 65 log.debug("Check file match for callable %s in module %s", -
trunk/nose/loader.py
r62 r70 309 309 # FIXME this needs to be moved and generalized for methods? 310 310 def generateTests(self, test): 311 """Generate tests from a test function that is a generator. 312 Returns list of test functions. 313 """ 311 314 cases = [] 312 315 for expr in test(): … … 338 341 339 342 def method_test_case(cls): 343 """Return a method test case factory bound to cls. 344 """ 340 345 def make_test_case(test_name): 341 346 """Method test case factory. May return a method test case, or a -
trunk/CHANGELOG
r62 r70 1 0.9.0 2 3 - More unit tests and better test coverage. Numerous bugfixes deriving from 4 same. 5 - Make --exe option do what it says, and turn it on by default on 6 Windows. Add --noexe option so windows users can turn if off.Thanks 7 richard@artsalliancemedia.com for the bug reports. 8 - Handle a working directory that happens to be in the middle of a package 9 more gracefully. Thanks Max Ischenko for the bug report and test case. 10 - Fix bugs in test name comparison when a test module is specified whose name 11 overlaps that of a non-test module. Thanks Max Ischenko for the bug report 12 and test case. 13 - Fix warning spam when a non-existent test file is requested on the command 14 line. Thanks Max Ischenko for the bug report. 15 1 16 0.9.0b2 2 17 -
trunk/index.html.tpl
r62 r70 84 84 margin: 0 1em .5em; 85 85 } 86 87 #menu ul li { 88 font-size: 90%%; 89 color:#666; 90 } 86 91 87 92 #menu dd { … … 183 188 <h2><a href="nose-%(version)s.tar.gz">Download</a></h2> 184 189 <p>Current version: %(version)s <br />(%(date)s)</p> 185 190 185 190 <h2>Install</h2> 186 191 <p>Current version: <br /><tt>easy_install nose==%(version)s</tt></p> 187 192 <p>Unstable (trunk): <br /><tt>easy_install nose==dev</tt></p> 188 189 <h2><a href="#usage">nosetests usage</a></h2> 190 <p>How to use the command-line test runner.</p> 193 194 <h2>Read</h2> 195 <ul> 196 <li> 197 <a href="http://ivory.idyll.org/articles/nose-intro.html"> 198 An Extended Introduction to the nose Unit Testing Framework 199 </a> 200 <br />Titus Brown's excellent article provides a great overview of 201 nose and its uses. 202 </li> 203 <li><a href="#usage">nosetests usage</a> 204 <br />How to use the command-line test runner. 205 </li> 206 </ul> 191 207 192 208 <h2><a href="http://groups.google.com/group/nose-announce"> -
trunk/NEWS
r31 r70 1 New in version 0.9.0a1 1 New in version 0.9 2 ------------------ 3 4 0.9 Final is here! 5 ================== 2 6 3 7 nose 0.9 includes a host of new features, as well as numerous 4 backwards-incompatible changes to interfaces and implementation. For this 5 reason, I'm releasing it first as an alpha version. 8 backwards-incompatible changes to interfaces and implementation. 6 9 7 10 Thanks to the many folks who have contributed patches and ideas and made bug 8 11 reports for the development version of 0.9, especially Mika Eloranta, Jay 9 Parlar, Kevin Dangoor, Scot Doyle and Philip J.Eby. 12 Parlar, Kevin Dangoor, Scot Doyle, Titus Brown and Philip J.Eby. 9 12 10 Here's a quick rundown of what's new in 0.9 .0a1.13 Here's a quick rundown of what's new in 0.9 10 13 11 14 - Plugins
