Changeset 87

Show
Ignore:
Timestamp:
07/11/06 16:02:40 (6 years ago)
Author:
grig
Message:

Added back Will's changes. The only functional test that was failing was testing a single file archive. Accounted for that in the pylint index.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/mk/cheesecake/cheesecake_index.py

    r85 r87  
    844844        cnt = 0 
    845845 
     846        # wbg: switching cwd so that pylint works correctly regarding 
     847        # running it on individual modules 
     848        original_cwd = os.getcwd() 
     849        # change dir to top of the package tree 
     850        # package_dir may be a file if the archive contains a single file... 
     851        # if this is the case, change dir to the parent dir of that file 
     852        if os.path.isfile(package_dir): 
     853            package_dir = os.path.dirname(package_dir) 
     854        os.chdir(package_dir) 
     855 
    846856        for pyfile in get_files_of_type(files_list, 'module'): 
    847             fullpath = os.path.join(package_dir, pyfile) 
     857            # wbg: because we change the working dir, we can use relative 
     858            # paths which pylint is happier about. 
     859            # fullpath = os.path.join(package_dir, pyfile) 
     860            fullpath = pyfile 
    848861            path, filename = os.path.split(fullpath) 
    849862            module, ext = os.path.splitext(filename) 
     
    868881                pylint_value += float(score) 
    869882                cnt += 1 
     883 
     884        # wbg: switching back to the original cwd in case that's important 
     885        os.chdir(original_cwd) 
    870886 
    871887        avg_score = 0 
  • branches/mk/tests/functional/test_cleaning_up.py

    r64 r87  
    2121 
    2222    def test_valid_no_tmp(self): 
    23         "Check that no files are left in temp by Cheesecake." 
     23        "Check that no files are leave in temp by Cheesecake." 
    2424        self._run_cheesecake('-p %s -s %s -l %s' % (NOSE_PATH, self.sandbox, self.logfile)) 
    2525 
    2626        self._assert_success() 
    2727 
    28         # Check that Cheesecake didn't left sandbox. 
     28        # Check that Cheesecake didn't leave sandbox. 
    2929        assert not os.path.exists(self.sandbox) 
    3030 
     
    3232        assert not os.path.exists(self.logfile) 
    3333 
    34         # Check that Cheesecake didn't left any cheesecake* files. 
     34        # Check that Cheesecake didn't leave any cheesecake* files. 
    3535        assert glob(os.path.join(tempfile.gettempdir(), "cheesecake*")) == [] 
    3636 
    37         # Check that Cheesecake didn't left any new tmp* files. 
     37        # Check that Cheesecake didn't leave any new tmp* files. 
    3838        assert filter_our_files(get_tmp_files()) == self.temp_files 
    3939 
    4040    def test_invalid_no_tmp(self): 
    41         "Check that no files are left in temp by Cheesecake during scoring an invalid package." 
     41        "Check that no files are leave in temp by Cheesecake during scoring an invalid package." 
    4242        self._run_cheesecake('-p %s -s %s -l %s' % (INVALID_PACKAGE_PATH, self.sandbox, self.logfile)) 
    4343 
     
    4545        self._assert_success() 
    4646 
    47         # Check that Cheesecake didn't left sandbox. 
     47        # Check that Cheesecake didn't leave sandbox. 
    4848        assert not os.path.exists(self.sandbox) 
    4949 
    50         # Check that Cheesecake didn't left any cheesecake* files. 
     50        # Check that Cheesecake didn't leave any cheesecake* files. 
    5151        assert glob(os.path.join(tempfile.gettempdir(), "cheesecake*")) == [] 
    5252 
    53         # Check that Cheesecake didn't left any new tmp* files. 
     53        # Check that Cheesecake didn't leave any new tmp* files. 
    5454        assert filter_our_files(get_tmp_files()) == self.temp_files 
     55 
     56        # Delete the log file, so that it doesn't pollute /tmp 
     57        self._cleanup_logfile() 
     58 
     59    def _cleanup_logfile(self): 
     60        os.unlink(self.logfile)