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

Fix Python 3.9 compatibility in test_log_utils

Jelmer Vernooij 3 месяцев назад
Родитель
Сommit
566a48d706
2 измененных файлов с 3 добавлено и 2 удалено
  1. 1 1
      dulwich/log_utils.py
  2. 2 1
      tests/test_log_utils.py

+ 1 - 1
dulwich/log_utils.py

@@ -93,7 +93,7 @@ def _get_trace_target() -> Optional[Union[str, int]]:
         pass
 
     # If it's an absolute path, return it as a string
-    if trace_value.startswith("/"):
+    if os.path.isabs(trace_value):
         return trace_value
 
     # For any other value, treat it as disabled

+ 2 - 1
tests/test_log_utils.py

@@ -24,6 +24,7 @@
 import logging
 import os
 import tempfile
+from typing import Optional
 
 from dulwich.log_utils import (
     _DULWICH_LOGGER,
@@ -59,7 +60,7 @@ class LogUtilsTests(TestCase):
             os.environ["GIT_TRACE"] = self.original_git_trace
         super().tearDown()
 
-    def _set_git_trace(self, value: str | None) -> None:
+    def _set_git_trace(self, value: Optional[str]) -> None:
         """Helper to set GIT_TRACE environment variable."""
         if value is None:
             os.environ.pop("GIT_TRACE", None)