Changeset 23
- Timestamp:
- 05/29/06 13:12:38 (7 years ago)
- Files:
-
- branches/mk/cheesecake/cheesecake_index.py (modified) (6 diffs)
- branches/mk/tests/test_count_files.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/mk/cheesecake/cheesecake_index.py
r22 r23 33 33 34 34 default_temp_directory = os.path.join(tempfile.gettempdir(), 'cheesecake_sandbox') 35 36 37 def has_extension(filename, ext): 38 return os.path.splitext(filename)[1] == ext 35 39 36 40 … … 604 608 for rootdir, dirs, files in os.walk(self.package_name): 605 609 head, tail = os.path.split(rootdir) 606 dirs_in_rootdir = rootdir.split(os.path.sep) 610 611 # Don't take package name into account when checking 612 # directories' names. 613 dirs_in_rootdir = rootdir.split(os.path.sep)[1:] 614 607 615 for cheese_dir in self.cheese_dirs: 608 616 if re.search("^%s" % cheese_dir, tail): … … 645 653 self.docstring_cnt += code.docstring_count() 646 654 self.functions += code.functions 647 648 if os.path.splitext(file)[1] == ".pyc": 655 elif self.is_test_file(file, dirs_in_rootdir): 656 self.pkg_files["test"].append(fullpath) 657 self.log.debug("test file found: " + fullpath) 658 elif self.is_pyc_file(file, dirs_in_rootdir): 649 659 self.pkg_files["pyc"].append(fullpath) 650 660 self.log.debug("pyc file found: " + fullpath) 651 652 if self.is_test_file(file, dirs_in_rootdir):653 self.pkg_files["test"].append(fullpath)654 self.log.debug("test file found: " + fullpath)655 661 656 662 len_pyc_list = len(self.pkg_files["pyc"]) … … 664 670 os.chdir(cwd) 665 671 672 def is_pyc_file(self, filename, dirs): 673 return has_extension(file, ".pyc") 674 666 675 def is_py_file(self, file, dirs): 667 676 """ … … 669 678 in special directory 670 679 """ 671 if os.path.splitext(file)[1] != ".py":680 if not has_extension(file, ".py"): 672 681 return False 673 682 if file in ["setup.py", "ez_setup.py", "__init__.py", "__pkginfo__.py"]: … … 681 690 return True 682 691 683 def is_test_file(self, file , dirs):692 def is_test_file(self, filename, dirs): 684 693 """ 685 694 Return True is file is in directory rooted at "test" or "tests" 686 695 """ 687 if not file.endswith(".py"):696 if not has_extension(filename, ".py"): 688 697 return False 689 698 if file in ["__init__.py"]:
