From 35551f989b91c87d44c2b81b5b12e643060fdbe7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Apr 11 2019 14:51:20 +0000 Subject: Reenable test_posix.test_fs_holes() Since 2012, when the test was skipped from Python 3.3.0b1 (commit 3b4dd24c42a177bd8bda0ebf127f199ef32364ef), Linux now have a good support for punching holes in filesystems. Only 00160-disable-test_fs_holes-in-rpm-build.patch and 00163-disable-parts-of-test_socket-in-rpm-build.patch patches used @unittest._skipInRpmBuild @unittest._expectedFailureInRpmBuild decorators, but these 2 patches have been removed: remove 00132-add-rpmbuild-hooks-to-unittest.patch and WITHIN_PYTHON_RPM_BUILD environment variable as well. --- diff --git a/00132-add-rpmbuild-hooks-to-unittest.patch b/00132-add-rpmbuild-hooks-to-unittest.patch deleted file mode 100644 index b187c6a..0000000 --- a/00132-add-rpmbuild-hooks-to-unittest.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff --git a/Lib/unittest/__init__.py b/Lib/unittest/__init__.py -index 5ff1bf3..4d63954 100644 ---- a/Lib/unittest/__init__.py -+++ b/Lib/unittest/__init__.py -@@ -58,7 +58,7 @@ __unittest = True - - from .result import TestResult - from .case import (addModuleCleanup, TestCase, FunctionTestCase, SkipTest, skip, -- skipIf, skipUnless, expectedFailure) -+ skipIf, skipUnless, expectedFailure, _skipInRpmBuild) - from .suite import BaseTestSuite, TestSuite - from .loader import (TestLoader, defaultTestLoader, makeSuite, getTestCaseNames, - findTestCases) -diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py -index a157ae8..64f912c 100644 ---- a/Lib/unittest/case.py -+++ b/Lib/unittest/case.py -@@ -3,6 +3,7 @@ - import sys - import functools - import difflib -+import os - import logging - import pprint - import re -@@ -158,6 +159,22 @@ class _BaseTestCaseContext: - msg = self.test_case._formatMessage(self.msg, standardMsg) - raise self.test_case.failureException(msg) - -+# Non-standard/downstream-only hooks for handling issues with specific test -+# cases: -+ -+def _skipInRpmBuild(reason): -+ """ -+ Non-standard/downstream-only decorator for marking a specific unit test -+ to be skipped when run within the %check of an rpmbuild. -+ -+ Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within -+ the environment, and has no effect otherwise. -+ """ -+ if 'WITHIN_PYTHON_RPM_BUILD' in os.environ: -+ return skip(reason) -+ else: -+ return _id -+ - class _AssertRaisesBaseContext(_BaseTestCaseContext): - - def __init__(self, expected, test_case, expected_regex=None): diff --git a/00160-disable-test_fs_holes-in-rpm-build.patch b/00160-disable-test_fs_holes-in-rpm-build.patch deleted file mode 100644 index 9fa91d5..0000000 --- a/00160-disable-test_fs_holes-in-rpm-build.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -up cpython-59223da36dec/Lib/test/test_posix.py.disable-test_fs_holes-in-rpm-build cpython-59223da36dec/Lib/test/test_posix.py ---- cpython-59223da36dec/Lib/test/test_posix.py.disable-test_fs_holes-in-rpm-build 2012-08-07 17:15:59.000000000 -0400 -+++ cpython-59223da36dec/Lib/test/test_posix.py 2012-08-07 17:16:53.528330330 -0400 -@@ -973,6 +973,7 @@ class PosixTester(unittest.TestCase): - posix.RTLD_GLOBAL - posix.RTLD_LOCAL - -+ @unittest._skipInRpmBuild('running kernel may not match kernel in chroot') - @unittest.skipUnless(hasattr(os, 'SEEK_HOLE'), - "test needs an OS that reports file holes") - def test_fs_holes(self): diff --git a/python38.spec b/python38.spec index 341d436..036563b 100644 --- a/python38.spec +++ b/python38.spec @@ -239,28 +239,6 @@ Patch102: 00102-lib64.patch # Downstream only: not appropriate for upstream Patch111: 00111-no-static-lib.patch -# 00132 # -# Add non-standard hooks to unittest for use in the "check" phase below, when -# running selftests within the build: -# @unittest._skipInRpmBuild(reason) -# for tests that hang or fail intermittently within the build environment, and: -# @unittest._expectedFailureInRpmBuild -# for tests that always fail within the build environment -# -# The hooks only take effect if WITHIN_PYTHON_RPM_BUILD is set in the -# environment, which we set manually in the appropriate portion of the "check" -# phase below (and which potentially other python-* rpms could set, to reuse -# these unittest hooks in their own "check" phases) -Patch132: 00132-add-rpmbuild-hooks-to-unittest.patch - -# 00160 # -# Python 3.3 added os.SEEK_DATA and os.SEEK_HOLE, which may be present in the -# header files in the build chroot, but may not be supported in the running -# kernel, hence we disable this test in an rpm build. -# Adding these was upstream issue http://bugs.python.org/issue10142 -# Not yet sent upstream -Patch160: 00160-disable-test_fs_holes-in-rpm-build.patch - # 00178 # # Don't duplicate various FLAGS in sysconfig values # http://bugs.python.org/issue17679 @@ -553,8 +531,6 @@ rm -r Modules/expat %patch102 -p1 %endif %patch111 -p1 -%patch132 -p1 -%patch160 -p1 %patch178 -p1 %if %{with rpmwheels} @@ -967,17 +943,13 @@ CheckPython() { # Show some info, helpful for debugging test failures LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.pythoninfo - # Run the upstream test suite, setting "WITHIN_PYTHON_RPM_BUILD" so that the - # our non-standard decorators take effect on the relevant tests: - # @unittest._skipInRpmBuild(reason) - # @unittest._expectedFailureInRpmBuild + # Run the upstream test suite # test_gdb skipped on armv7hl: # https://bugzilla.redhat.com/show_bug.cgi?id=1196181 # test_gdb skipped on s390x: # https://bugzilla.redhat.com/show_bug.cgi?id=1678277 # test_asyncio skipped: # https://bugs.python.org/issue35998 - WITHIN_PYTHON_RPM_BUILD= \ LD_LIBRARY_PATH=$ConfDir $ConfDir/python -m test.regrtest \ -wW --slowest -j0 \ -x test_distutils \