]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-111881: Use lazy import in test.support (#111885) (#111890) (#111902)
authorVictor Stinner <vstinner@python.org>
Thu, 9 Nov 2023 16:46:27 +0000 (17:46 +0100)
committerGitHub <noreply@github.com>
Thu, 9 Nov 2023 16:46:27 +0000 (16:46 +0000)
[3.12] gh-111881: Use lazy import in test.support (#111885) (#111890)

gh-111881: Use lazy import in test.support (#111885)

* Import lazily getpass in test.support

Backport to 3.11: test.support.os_helper is unchanged.

(cherry picked from commit 0372e3b02a7e3dc1c564dba94dcd817c5472b04f)
(cherry picked from commit e983ca859de279682631dbb13b959f14a7d89a7b)

Lib/test/support/__init__.py

index 7ebc42e5bdd01c5816cf718e23b156196628496c..dc7a6e6741b8bbb418547c99897aa04e592cdca1 100644 (file)
@@ -6,7 +6,6 @@ if __name__ != 'test.support':
 import contextlib
 import dataclasses
 import functools
-import getpass
 import os
 import re
 import stat
@@ -380,6 +379,7 @@ def requires_mac_ver(*min_version):
 
 def skip_if_buildbot(reason=None):
     """Decorator raising SkipTest if running on a buildbot."""
+    import getpass
     if not reason:
         reason = 'not suitable for buildbots'
     try: