From 3455467f7c5f841915a1fa81e1336312df503494 Mon Sep 17 00:00:00 2001 From: wonder-mice Date: Tue, 11 Jan 2022 00:41:03 -0800 Subject: [PATCH 1/2] import unittest adds 0.250s to script launch time This should not be imported at root level, since it adds a lot of initialization overhead without need. --- git/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/util.py b/git/util.py index b81332ea4..6e6f09557 100644 --- a/git/util.py +++ b/git/util.py @@ -20,7 +20,6 @@ import stat from sys import maxsize import time -from unittest import SkipTest from urllib.parse import urlsplit, urlunsplit import warnings @@ -130,6 +129,7 @@ def onerror(func: Callable, path: PathLike, exc_info: str) -> None: func(path) # Will scream if still not possible to delete. except Exception as ex: if HIDE_WINDOWS_KNOWN_ERRORS: + from unittest import SkipTest raise SkipTest("FIXME: fails with: PermissionError\n {}".format(ex)) from ex raise From 454323651fbf2b356298dcd4e8ad8f42a1779924 Mon Sep 17 00:00:00 2001 From: wonder-mice Date: Tue, 11 Jan 2022 00:44:25 -0800 Subject: [PATCH 2/2] import unittest adds 0.250s to script launch time This should not be imported at root level, since it adds a lot of initialization overhead without need. --- git/objects/submodule/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index d306c91d4..f78204555 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -3,8 +3,6 @@ import logging import os import stat - -from unittest import SkipTest import uuid import git @@ -934,6 +932,7 @@ def remove(self, module: bool = True, force: bool = False, rmtree(str(wtd)) except Exception as ex: if HIDE_WINDOWS_KNOWN_ERRORS: + from unittest import SkipTest raise SkipTest("FIXME: fails with: PermissionError\n {}".format(ex)) from ex raise # END delete tree if possible @@ -945,6 +944,7 @@ def remove(self, module: bool = True, force: bool = False, rmtree(git_dir) except Exception as ex: if HIDE_WINDOWS_KNOWN_ERRORS: + from unittest import SkipTest raise SkipTest(f"FIXME: fails with: PermissionError\n {ex}") from ex else: raise