Просмотр исходного кода

Fix tests failing if "build" in project absolute path (#2055)

For Arch Linux package builds, the source is checked out in a path 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...).
Jelmer Vernooij 1 неделя назад
Родитель
Сommit
f26cd5a366
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", "__pycache__")):
                 continue
 
             for file in files: