From: Victor Stinner Date: Thu, 9 Nov 2023 16:46:27 +0000 (+0100) Subject: [3.11] gh-111881: Use lazy import in test.support (#111885) (#111890) (#111902) X-Git-Tag: v3.11.7~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f108976ebbfe28bc5c9a62d95555c7adc396b82f;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-111881: Use lazy import in test.support (#111885) (#111890) (#111902) [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) --- diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 7ebc42e5bdd0..dc7a6e6741b8 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -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: