Skip to content

Commit 74ded76

Browse files
committed
gh-103053: Skip the whole test_freeze module in tests on buildbots
1 parent 848bdbe commit 74ded76

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Lib/test/support/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,15 +388,19 @@ def wrapper(*args, **kw):
388388
return decorator
389389

390390

391-
def skip_if_buildbot(reason=None):
391+
def skip_if_buildbot(reason=None, *, raise_error=False):
392392
"""Decorator raising SkipTest if running on a buildbot."""
393393
if not reason:
394394
reason = 'not suitable for buildbots'
395395
try:
396396
isbuildbot = getpass.getuser().lower() == 'buildbot'
397+
if not isbuildbot: # TODO: remove
398+
warnings.warn(f'getpass.getuser() returned {getpass.getuser()}.', RuntimeWarning)
397399
except (KeyError, EnvironmentError) as err:
398400
warnings.warn(f'getpass.getuser() failed {err}.', RuntimeWarning)
399401
isbuildbot = False
402+
if raise_error and isbuildbot:
403+
raise unittest.SkipTest(reason)
400404
return unittest.skipIf(isbuildbot, reason)
401405

402406
def check_sanitizer(*, address=False, memory=False, ub=False):

Lib/test/test_tools/test_freeze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
from test.support import os_helper
99
from test.test_tools import imports_under_tool, skip_if_missing
1010

11+
support.skip_if_buildbot('not all buildbots have enough space', raise_error=True)
1112
skip_if_missing('freeze')
1213
with imports_under_tool('freeze', 'test'):
1314
import freeze as helper
1415

1516
@support.requires_zlib()
1617
@unittest.skipIf(sys.platform.startswith('win'), 'not supported on Windows')
17-
@support.skip_if_buildbot('not all buildbots have enough space')
1818
class TestFreeze(unittest.TestCase):
1919

2020
def test_freeze_simple_script(self):

0 commit comments

Comments
 (0)