Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3c73294

Browse files
authored
Merge pull request#3746 from Zac-HD/enable-explain-mode
2 parents03d8312 +c419bc5 commit3c73294

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

‎hypothesis-python/RELEASE.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RELEASE_TYPE: minor
2+
3+
This release enables the:obj:`~hypothesis.Phase.explain`:ref:`phase<phases>`
4+
by default. We hope it helps you to understand _why_ your failing tests have
5+
failed!

‎hypothesis-python/src/hypothesis/_settings.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,7 @@ def _validate_phases(phases):
572572

573573
settings._define_setting(
574574
"phases",
575-
# We leave the `explain` phase disabled by default, for speed and brevity
576-
# TODO: consider default-enabling this in CI?
577-
default=_validate_phases(set(Phase)- {Phase.explain}),
575+
default=tuple(Phase),
578576
description=(
579577
"Control which phases should be run. "
580578
"See :ref:`the full documentation for more details <phases>`"

‎hypothesis-python/src/hypothesis/statistics.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
importmath
1212
fromcollectionsimportCounter
1313

14+
fromhypothesis._settingsimportPhase
1415
fromhypothesis.utils.dynamicvariablesimportDynamicVariable
1516

1617
collector=DynamicVariable(None)
@@ -73,7 +74,7 @@ def describe_statistics(stats_dict):
7374
"""
7475
lines= [stats_dict["nodeid"]+":\n"]if"nodeid"instats_dictelse []
7576
prev_failures=0
76-
forphasein["reuse","generate","shrink"]:
77+
forphasein(p.nameforpinlist(Phase)[1:]):
7778
d=stats_dict.get(phase+"-phase", {})
7879
# Basic information we report for every phase
7980
cases=d.get("test-cases", [])

‎hypothesis-python/tests/cover/test_phases.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def test_sorts_and_dedupes_phases(arg, expected):
4747
assertsettings(phases=arg).phases==expected
4848

4949

50-
deftest_phases_default_to_all_except_explain():
51-
assert(*all_settings["phases"].default,Phase.explain)==tuple(Phase)
50+
deftest_phases_default_to_all():
51+
assertall_settings["phases"].default==tuple(Phase)
5252

5353

5454
deftest_does_not_reuse_saved_examples_if_reuse_not_in_phases():

‎hypothesis-python/tests/cover/test_settings.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def __repr__(self):
474474

475475

476476
deftest_show_changed():
477-
s=settings(max_examples=999,database=None,phases=tuple(Phase)[:-1])
477+
s=settings(max_examples=999,database=None)
478478
asserts.show_changed()=="database=None, max_examples=999"
479479

480480

‎hypothesis-python/tests/cover/test_statistical_events.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def threshold(error):
247247

248248

249249
deftest_statistics_with_events_and_target():
250-
@given(st.sampled_from("1234"))
250+
@given(st.integers(0,10_000))
251251
deftest(value):
252252
event(value)
253253
target(float(value),label="a target")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp