Changeset 36

Show
Ignore:
Timestamp:
03/14/2008 06:40:29 PM (10 months ago)
Author:
mikeal
Message:

Fixing imports of modules that do not begin with 'test'.

-Mikeal

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/functest/collector.py

    r29 r36  
    3232            module = imp.load_module(name, filename, pathname, description) 
    3333            module.functest_module_path = path 
     34            module.__file__ = os.path.abspath(path) 
    3435            sys.path.pop(0) 
    3536        elif os.path.isdir(path): 
     
    4142                module = imp.load_module(name, filename, pathname, description) 
    4243                module.functest_module_path = path 
     44                module.__file__ = os.path.abspath(path+'.__init__.py') 
    4345                sys.path.pop(0) 
    4446            else: 
     
    5860        while os.path.isfile(os.path.join(path, '__init__.py')): 
    5961            module_chain.append(self.import_module(path)) 
    60             split = list(os.path.split(path)) 
    61             split.pop(-1) 
    62             path = os.path.join(*split) 
     62            path = os.path.join(*os.path.split(path)[-1]) 
    6363        module_chain.reverse() 
    6464        return module_chain 
     
    7575                func(test_module) 
    7676            for filename in [ f for f in os.listdir(path) if ( not f.startswith('.') ) and  
     77                             ( f.startswith('test') ) and 
    7778                             ( ( f.endswith('.py') ) or  
    7879                               ( os.path.isdir(os.path.join(path, f)) and         
    79                                  os.path.isfile(os.path.join(path, f, '__init__.py')) )  
    80                              ) ]: 
     80                                 os.path.isfile(os.path.join(path, f, '__init__.py'))  
     81                               )  
     82                             )  
     83                             ]: 
    8184                setattr(test_module, filename.split('.')[0], self.create_test_module(os.path.join(path, filename))) 
    8285        else: