Changeset 80

Show
Ignore:
Timestamp:
Thu Jul 27 13:54:03 2006
Author:
jpellerin
Message:

Updated path handling in multi-where case to make absfile, import, etc relative only to the current working directory, not to the first matching path in conf.where.

Files:

Legend:

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

    r70 r80  
    49 49         for test in l.loadTestsFromName(name):  
    50 50             found.append(str(test))  
    51           # print found  
      51         print found  
    51 51         self.assertEqual(found, expect)  
    52 52                  
  • trunk/nose/selector.py

    r70 r80  
    60 60                     filename = filename[:-3] + 'py'  
    61 61                 if not os.path.isabs(filename):  
    62                       filename = absfile(filename, self.conf.where)  
      62                     filename = absfile(filename, self.conf.working_dir)  
    62 62                     if filename is None:  
    63 63                         log.debug("File %s not found",  orig)  
     
    74 74                     log.debug("module file: %s", mod_file)  
    75 75                     if not os.path.isabs(mod_file):  
    76                           mod_file = absfile(mod_file, self.conf.where)  
      76                         mod_file = absfile(mod_file, self.conf.working_dir)  
    76 76                     log.debug("%s == %s?", mod_file, filename)  
    77 77                     if mod_file == filename:  
     
    120 120         orig = file  
    121 121         if not os.path.isabs(file):  
    122               file = absfile(file, self.conf.where)  
      122             file = absfile(file, self.conf.working_dir)  
    122 122             log.debug("abs file %s is %s", orig, file)  
    123 123         if file is None:  
     
    141 141                     return False                     
    142 142             if not os.path.isabs(filename):  
    143                   filename = absfile(filename, self.conf.where)  
      143                 filename = absfile(filename, self.conf.working_dir)  
    143 143             return filename == file  
    144 144         log.debug('Check file in tests')  
  • trunk/nose/config.py

    r62 r80  
    26 26         self.tests = []  
    27 27         self.verbosity = 1  
    28           self.where = None  
      28         self._where = None  
      29         self._working_dir = None  
    29 30         self.update(kw)  
    30 31         self._orig = self.__dict__.copy()  
      32  
      33     def get_where(self):  
      34         return self._where  
      35  
      36     def set_where(self, val):  
      37         self._where = val  
      38         self._working_dir = None  
      39  
      40     def get_working_dir(self):  
      41         val = self._working_dir  
      42         if val is None:  
      43             if isinstance(self.where, list) or isinstance(self.where, tuple):  
      44                 val = self._working_dir = self.where[0]  
      45             else:  
      46                 val = self._working_dir = self.where  
      47         return val  
      48  
      49     def set_working_dir(self, val):  
      50         self._working_dir = val  
    31 51          
    32 52     def __str__(self):  
     
    42 62     def update(self, d):  
    43 63         self.__dict__.update(d)  
      64  
      65     # properties  
      66     where = property(get_where, set_where, None,  
      67                      "The list of directories where tests will be discovered")  
      68     working_dir = property(get_working_dir, set_working_dir, None,  
      69                            "The current working directory (the root "  
      70                            "directory of the current test run).")  
  • trunk/nose/loader.py

    r70 r80  
    50 50             raise ValueError("Dir paths must be specified as "  
    51 51                              "absolute paths (%s)" % dirname)  
    52    
      52         self.conf.working_dir = dirname  
      53          
    53 54         # to ensure that lib paths are set up correctly before tests are  
    54 55         # run, examine directories that look like lib or module  
     
    110 111             module_name = "%s.%s" % (package, module_name)  
    111 112         if importPath is None:  
    112               importPath = self.conf.where  
      113             importPath = self.conf.working_dir  
    112 113         yield TestModule(self.loadTestsFromModule,  
    113 114                          self.conf, module_name, importPath)