Skip to content

Commit 465d2fb

Browse files
authored
[3.14] gh-162671: Support selecting hypothesis tests by label (GH-162672) (#162692)
(cherry picked from commit 9fe52e9) Co-authored-by: sobolevn <mail@sobolevn.me>
1 parent 6d558e1 commit 465d2fb

5 files changed

Lines changed: 17 additions & 3 deletions

File tree

‎Lib/test/support/hypothesis_helper.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import os
22

3+
from test.support import mark
4+
35
try:
46
import hypothesis
57
except ImportError:
@@ -51,3 +53,5 @@
5153
),
5254
)
5355
hypothesis.settings.load_profile("cpython-local-dev")
56+
57+
mark_hypothesis = mark("hypothesis")

‎Lib/test/test_binascii.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import array
66
import re
77
from test.support import bigmemtest, _1G, _4G
8-
from test.support.hypothesis_helper import hypothesis
8+
from test.support.hypothesis_helper import hypothesis, mark_hypothesis
99

1010

1111
# Note: "*_hex" functions are aliases for "(un)hexlify"
@@ -265,6 +265,7 @@ def test_uu(self):
265265
binary=hypothesis.strategies.binary(max_size=45),
266266
backtick=hypothesis.strategies.booleans(),
267267
)
268+
@mark_hypothesis
268269
def test_b2a_roundtrip(self, binary, backtick):
269270
converted = binascii.b2a_uu(self.type2test(binary), backtick=backtick)
270271
restored = binascii.a2b_uu(self.type2test(converted))
@@ -308,6 +309,7 @@ def test_hex(self):
308309
self.assertEqual(binascii.unhexlify(self.type2test(t)), u)
309310

310311
@hypothesis.given(binary=hypothesis.strategies.binary())
312+
@mark_hypothesis
311313
def test_hex_roundtrip(self, binary):
312314
converted = binascii.hexlify(self.type2test(binary))
313315
restored = binascii.unhexlify(self.type2test(converted))
@@ -433,6 +435,7 @@ def test_qp(self):
433435
istext=hypothesis.strategies.booleans(),
434436
header=hypothesis.strategies.booleans(),
435437
)
438+
@mark_hypothesis
436439
def test_b2a_qp_a2b_qp_round_trip(self, binary, quotetabs, istext, header):
437440
converted = binascii.b2a_qp(
438441
self.type2test(binary),
@@ -504,6 +507,7 @@ def test_b2a_base64_newline(self):
504507
binary=hypothesis.strategies.binary(),
505508
newline=hypothesis.strategies.booleans(),
506509
)
510+
@mark_hypothesis
507511
def test_base64_roundtrip(self, binary, newline):
508512
converted = binascii.b2a_base64(self.type2test(binary), newline=newline)
509513
restored = binascii.a2b_base64(self.type2test(converted))

‎Lib/test/test_math_property.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import functools
22
import unittest
33
from math import isnan, nextafter
4-
from test.support import requires_IEEE_754
4+
from test.support import requires_IEEE_754, mark_module
55
from test.support.hypothesis_helper import hypothesis
66

7+
mark_module('hypothesis')
8+
79
floats = hypothesis.strategies.floats
810
integers = hypothesis.strategies.integers
911

‎Lib/test/test_tools/test_makeunicodedata.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22
from test.test_tools import skip_if_missing, imports_under_tool
33
from test import support
4-
from test.support.hypothesis_helper import hypothesis
4+
from test.support.hypothesis_helper import hypothesis, mark_hypothesis
55

66
st = hypothesis.strategies
77
given = hypothesis.given
@@ -115,6 +115,7 @@ def test_forbid_empty_dawg(self):
115115
("ab", "1"),
116116
]
117117
)
118+
@mark_hypothesis
118119
def test_dawg(self, data):
119120
# suppress debug prints
120121
with support.captured_stdout() as output:

‎Lib/test/test_zoneinfo/test_zoneinfo_property.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
import unittest
66
import zoneinfo
77

8+
from test.support import mark_module
89
from test.support.hypothesis_helper import hypothesis
910

1011
import test.test_zoneinfo._support as test_support
1112

13+
mark_module('hypothesis')
14+
1215
ZoneInfoTestBase = test_support.ZoneInfoTestBase
1316

1417
py_zoneinfo, c_zoneinfo = test_support.get_modules()

0 commit comments

Comments
 (0)