unittests: optimize IS_CI checks

Since IS_CI is a boolean instead of a function, it's slightly faster to
check that before other things
This commit is contained in:
Dylan Baker
2026-01-21 08:58:34 -08:00
parent 862beade2b
commit 5494f29d03
3 changed files with 4 additions and 4 deletions

View File

@@ -2320,7 +2320,7 @@ class AllPlatformTests(BasePlatformTests):
# Call this method before file operations in appropriate places
# to make things work.
def mac_ci_delay(self):
if is_osx() and IS_CI:
if IS_CI and is_osx():
import time
time.sleep(1)

View File

@@ -208,7 +208,7 @@ def skip_if_env_set(key: str) -> T.Callable[[T.Callable[P, R]], T.Callable[P, R]
def wrapper(func: T.Callable[P, R]) -> T.Callable[P, R]:
@functools.wraps(func)
def wrapped(*args: P.args, **kwargs: P.kwargs) -> R:
if key in os.environ and not IS_CI:
if not IS_CI and key in os.environ:
raise unittest.SkipTest(f'Env var {key!r} set, skipping')
with mock.patch.dict(os.environ):
os.environ.pop(key, None)

View File

@@ -373,10 +373,10 @@ class WindowsTests(BasePlatformTests):
raise SkipTest('Compiler does not support setting the VS CRT')
# Verify that qmake is for Qt5
if not shutil.which('qmake-qt5'):
if not shutil.which('qmake') and not IS_CI:
if not IS_CI and not shutil.which('qmake'):
raise SkipTest('QMake not found')
output = subprocess.getoutput('qmake --version')
if 'Qt version 5' not in output and not IS_CI:
if not IS_CI and 'Qt version 5' not in output:
raise SkipTest('Qmake found, but it is not for Qt 5.')
# Setup with /MDd
testdir = os.path.join(self.framework_test_dir, '4 qt')