Changeset 93

Show
Ignore:
Timestamp:
Thu Aug 24 20:49:08 2006
Author:
jpellerin
Message:

r3545@Jason-Pellerins-Computer: jhp | 2006-08-24 20:49:02 -0500
Updated loader.loadTestsFromDir to place the dir onto sys.path before loading tests, unless conf.addPaths is off (#81).

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/unit_tests/test_loader.py

    r86 r93  
    231 231     def test_pkg_layout_lib_tests(self):  
    232 232         from mock import Result  
      233         from nose.util import absdir  
    233 234         r = Result()  
    234 235         l = loader.TestLoader()  
    235           where = os.path.join(os.path.dirname(__file__), 'support/pkgorg')  
      236         where = absdir(os.path.join(os.path.dirname(__file__),  
      237                                     'support/pkgorg'))  
    236 238         print "where", where  
    237           print "on path?", where + '/lib' in sys.path  
      239         print "/lib on path before load?", where + '/lib' in sys.path  
    237 239         tests = l.loadTestsFromDir(where)  
    238           print "on path?", where + '/lib' in sys.path  
      240         print "/lib on path after load?", where + '/lib' in sys.path  
    238 240         print "tests", tests  
    239 241         for t in tests:  
    240 242             print "test", t  
    241               assert t(r), "No tests loaded: %s" % r.errors  
      243             # this will raise an importerror if /lib isn't on the path  
      244             t(r)  
    242 245         assert where + '/lib' in sys.path  
    243 246          
  • trunk/unit_tests/support/pkgorg/tests/test_mod.py

    r86 r93  
    1 1 import modernity  
      2  
      3 def test():  
      4     pass  
     
  • trunk/nose/result.py

    r91 r93  
    30 30     conf = None  
    31 31     tbinfo = None  
      32     shouldStop = False  
    32 33      
    33 34     def addDeprecated(self, test):  
  • trunk/nose/loader.py

    r85 r93  
    10 10 from nose.case import *  
    11 11 from nose.config import Config  
      12 from nose.importer import add_path  
    12 13 from nose.plugins import call_plugins  
    13 14 from nose.selector import defaultSelector  
     
    51 52                              "absolute paths (%s)" % dirname)  
    52 53         self.conf.working_dir = dirname  
    53            
      54  
      55         # Ensure that any directory we examine is on sys.path  
      56         if self.conf.addPaths:  
      57             add_path(dirname)  
      58              
    54 59         # to ensure that lib paths are set up correctly before tests are  
    55 60         # run, examine directories that look like lib or module