From a620cbb35b2b2c4bcdf1ae5aa3273046751c972d Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 7 Jul 2025 17:22:39 +0300 Subject: [PATCH 1/5] gh-136297: Fix `hypothesis` and `subTest` usage in `test_zoneinfo_property.py` --- Lib/test/test_zoneinfo/test_zoneinfo_property.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_zoneinfo/test_zoneinfo_property.py b/Lib/test/test_zoneinfo/test_zoneinfo_property.py index 294c7e9b27a857..c00815e2fd4c36 100644 --- a/Lib/test/test_zoneinfo/test_zoneinfo_property.py +++ b/Lib/test/test_zoneinfo/test_zoneinfo_property.py @@ -147,23 +147,21 @@ def setUp(self): def test_pickle_unpickle_cache(self, key): zi = self.klass(key) for proto in range(pickle.HIGHEST_PROTOCOL + 1): - with self.subTest(proto=proto): - pkl_str = pickle.dumps(zi, proto) - zi_rt = pickle.loads(pkl_str) + pkl_str = pickle.dumps(zi, proto) + zi_rt = pickle.loads(pkl_str) - self.assertIs(zi, zi_rt) + self.assertIs(zi, zi_rt) @hypothesis.given(key=valid_keys()) @add_key_examples def test_pickle_unpickle_no_cache(self, key): zi = self.klass.no_cache(key) for proto in range(pickle.HIGHEST_PROTOCOL + 1): - with self.subTest(proto=proto): - pkl_str = pickle.dumps(zi, proto) - zi_rt = pickle.loads(pkl_str) + pkl_str = pickle.dumps(zi, proto) + zi_rt = pickle.loads(pkl_str) - self.assertIsNot(zi, zi_rt) - self.assertEqual(str(zi), str(zi_rt)) + self.assertIsNot(zi, zi_rt) + self.assertEqual(str(zi), str(zi_rt)) @hypothesis.given(key=valid_keys()) @add_key_examples From e4cb74cc9a9da346153a54fa1ce4dbb53a4534e1 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 7 Jul 2025 20:26:01 +0300 Subject: [PATCH 2/5] CI must fail now --- .github/workflows/build.yml | 2 +- Lib/test/test_zoneinfo/test_zoneinfo_property.py | 7 ++++--- Tools/requirements-hypothesis.txt | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c6171571857af6..ea5c14ff5c5955 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -427,7 +427,7 @@ jobs: # (GH-104097) test_sysconfig is skipped because it has tests that are # failing when executed from inside a virtual environment. "${VENV_PYTHON}" -m test \ - -W \ + -We \ --slowest \ -j4 \ --timeout 900 \ diff --git a/Lib/test/test_zoneinfo/test_zoneinfo_property.py b/Lib/test/test_zoneinfo/test_zoneinfo_property.py index c00815e2fd4c36..614b2a8ceaa58a 100644 --- a/Lib/test/test_zoneinfo/test_zoneinfo_property.py +++ b/Lib/test/test_zoneinfo/test_zoneinfo_property.py @@ -147,10 +147,11 @@ def setUp(self): def test_pickle_unpickle_cache(self, key): zi = self.klass(key) for proto in range(pickle.HIGHEST_PROTOCOL + 1): - pkl_str = pickle.dumps(zi, proto) - zi_rt = pickle.loads(pkl_str) + with self.subTest(proto=proto): + pkl_str = pickle.dumps(zi, proto) + zi_rt = pickle.loads(pkl_str) - self.assertIs(zi, zi_rt) + self.assertIs(zi, zi_rt) @hypothesis.given(key=valid_keys()) @add_key_examples diff --git a/Tools/requirements-hypothesis.txt b/Tools/requirements-hypothesis.txt index 66898885c0a412..e5deac497fbe3f 100644 --- a/Tools/requirements-hypothesis.txt +++ b/Tools/requirements-hypothesis.txt @@ -1,4 +1,4 @@ # Requirements file for hypothesis that # we use to run our property-based tests in CI. -hypothesis==6.111.2 +hypothesis==6.135.26 From 514bba00128e8933d3194574c37fd963a3eb51da Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 7 Jul 2025 20:37:32 +0300 Subject: [PATCH 3/5] CI must fail now --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea5c14ff5c5955..157e69847fad11 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -426,8 +426,8 @@ jobs: # # (GH-104097) test_sysconfig is skipped because it has tests that are # failing when executed from inside a virtual environment. - "${VENV_PYTHON}" -m test \ - -We \ + "${VENV_PYTHON}" -We -m test \ + -W \ --slowest \ -j4 \ --timeout 900 \ From cec90dbfbc72994eb11ce5ace3e8cf57f2bf37f3 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 7 Jul 2025 22:01:41 +0300 Subject: [PATCH 4/5] Remove `subTest` again --- Lib/test/test_zoneinfo/test_zoneinfo_property.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_zoneinfo/test_zoneinfo_property.py b/Lib/test/test_zoneinfo/test_zoneinfo_property.py index 614b2a8ceaa58a..c00815e2fd4c36 100644 --- a/Lib/test/test_zoneinfo/test_zoneinfo_property.py +++ b/Lib/test/test_zoneinfo/test_zoneinfo_property.py @@ -147,11 +147,10 @@ def setUp(self): def test_pickle_unpickle_cache(self, key): zi = self.klass(key) for proto in range(pickle.HIGHEST_PROTOCOL + 1): - with self.subTest(proto=proto): - pkl_str = pickle.dumps(zi, proto) - zi_rt = pickle.loads(pkl_str) + pkl_str = pickle.dumps(zi, proto) + zi_rt = pickle.loads(pkl_str) - self.assertIs(zi, zi_rt) + self.assertIs(zi, zi_rt) @hypothesis.given(key=valid_keys()) @add_key_examples From cda40c45b2420036fd6a72fa0b929fcc951dd7ec Mon Sep 17 00:00:00 2001 From: sobolevn Date: Tue, 8 Jul 2025 10:24:31 +0300 Subject: [PATCH 5/5] Address review --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 157e69847fad11..c6171571857af6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -426,7 +426,7 @@ jobs: # # (GH-104097) test_sysconfig is skipped because it has tests that are # failing when executed from inside a virtual environment. - "${VENV_PYTHON}" -We -m test \ + "${VENV_PYTHON}" -m test \ -W \ --slowest \ -j4 \