소스 검색

Fix tests failing if "build" in project absolute path

For Arch Linux package builds, the source is checked out a directory like:

    /build/python-dulwich/src/dulwich

This causes test_source.py::SourceCodeComplianceTests::_get_dulwich_python_files()
to return no Python files, and subsequently the following to tests to fail:

- tests/test_source.py::SourceCodeComplianceTests::test_all_files_have_preamble
- tests/test_source.py::SourceCodeComplianceTests::test_os_environ_usage_restricted

The root cause of this is that the check for "build" and "__pycache__" are to
broad and will skip any roots with these words anywhere in the path - which is
the case for us (/build...).
Carl Smedstad 2 주 전
부모
커밋
e133c69c8b
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      tests/test_source.py

+ 1 - 1
tests/test_source.py

@@ -82,7 +82,7 @@ class SourceCodeComplianceTests(unittest.TestCase):
         python_files = []
         for root, dirs, files in os.walk(dulwich_dir):
             # Skip build directories
-            if "build" in root or "__pycache__" in root:
+            if root.endswith("build") or root.endswith("__pycache__"):
                 continue
 
             for file in files: